forked from QuantumMalice/vehiclehandler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.lua
82 lines (67 loc) · 2.35 KB
/
server.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
lib.versionCheck("QuantumMalice/vehiclehandler")
local ox_lib, msg_lib = lib.checkDependency('ox_lib', '3.17.0')
if not ox_lib then print(msg_lib) return end
if GetResourceState('ox_inventory') == 'started' then
local ox_inv, msg_inv = lib.checkDependency('ox_inventory', '2.39.1')
if not ox_inv then print(msg_inv) return end
exports('cleaningkit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local success = lib.callback.await('vehiclehandler:basicwash', inventory.id)
if success then return end
return false
end
end)
exports('tirekit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local success = lib.callback.await('vehiclehandler:basicfix', inventory.id, 'tirekit')
if success then return end
return false
end
end)
exports('repairkit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local success = lib.callback.await('vehiclehandler:basicfix', inventory.id, 'smallkit')
if success then return end
return false
end
end)
exports('advancedrepairkit', function(event, item, inventory, slot, data)
if event == 'usingItem' then
local success = lib.callback.await('vehiclehandler:basicfix', inventory.id, 'bigkit')
if success then return end
return false
end
end)
end
lib.callback.register('vehiclehandler:sync', function()
return true
end)
lib.addCommand('fix', {
help = 'Repair current vehicle',
restricted = 'group.admin'
}, function(source, args, raw)
lib.callback('vehiclehandler:adminfix', source, function() end)
end)
lib.addCommand('wash', {
help = 'Clean current vehicle',
restricted = 'group.admin'
}, function(source, args, raw)
lib.callback('vehiclehandler:adminwash', source, function() end)
end)
lib.addCommand('setfuel', {
help = 'Set vehicle fuel level',
params = {
{
name = 'level',
type = 'number',
help = 'Amount of fuel to set',
},
},
restricted = 'group.admin'
}, function(source, args, raw)
local level = args.level
if level then
lib.callback('vehiclehandler:adminfuel', source, function()
end, level)
end
end)