-
Notifications
You must be signed in to change notification settings - Fork 34
/
cl_dev.lua
60 lines (53 loc) · 1.33 KB
/
cl_dev.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
local insert = table.insert
local remove = table.remove
--- [[ Development shit ]]
local devLocal = {}
local next = 0
RegisterCommand('setnext', function(_, args)
local n = tonumber(args[1])
if n ~= nil then
next = n
print('next ' .. next)
return
end
print('invalid ' .. n)
end)
RegisterCommand('next', function()
for _, d in ipairs(devLocal) do
if d.code == tostring(next) then
print('duplicate ' .. next)
return
end
end
local coords = GetEntityCoords(PlayerPedId())
insert(devLocal, { code = tostring(next), x = coords.x, y = coords.y })
print('insert ' .. next)
next = next + 1
end)
RegisterCommand('rl', function()
if #devLocal > 0 then
local data = remove(devLocal, #devLocal)
print('remove ' .. data.code)
print('next ' .. next)
next = next - 1
else
print('invalid')
end
end)
RegisterCommand('remove', function(_, args)
if #args < 1 then
print('invalid')
else
for i, d in ipairs(devLocal) do
if d.code == args[1] then
remove(devLocal, i)
print('remove ' .. d.code)
return
end
end
print('invalid')
end
end)
RegisterCommand('json', function()
print(json.encode(devLocal))
end)