forked from havenstadrp/qb-vehiclefailure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.lua
39 lines (34 loc) · 1.51 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
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Commands.Add("fix", "Repair your vehicle (Admin Only)", {}, false, function(source)
TriggerClientEvent('iens:repaira', source)
TriggerClientEvent('vehiclemod:client:fixEverything', source)
end, "admin")
QBCore.Functions.CreateUseableItem("repairkit", function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.GetItemBySlot(item.slot) ~= nil then
TriggerClientEvent("qb-vehiclefailure:client:RepairVehicle", source)
end
end)
QBCore.Functions.CreateUseableItem("cleaningkit", function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.GetItemBySlot(item.slot) ~= nil then
TriggerClientEvent("qb-vehiclefailure:client:CleanVehicle", source)
end
end)
QBCore.Functions.CreateUseableItem("advancedrepairkit", function(source, item)
local Player = QBCore.Functions.GetPlayer(source)
if Player.Functions.GetItemBySlot(item.slot) ~= nil then
TriggerClientEvent("qb-vehiclefailure:client:RepairVehicleFull", source)
end
end)
RegisterNetEvent('qb-vehiclefailure:removeItem', function(item)
local src = source
local ply = QBCore.Functions.GetPlayer(src)
ply.Functions.RemoveItem(item, 1)
end)
RegisterNetEvent('qb-vehiclefailure:server:removewashingkit', function(veh)
local src = source
local ply = QBCore.Functions.GetPlayer(src)
ply.Functions.RemoveItem("cleaningkit", 1)
TriggerClientEvent('qb-vehiclefailure:client:SyncWash', -1, veh)
end)