40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
|
local QBCore = exports['qb-core']:GetCoreObject()
|
||
|
|
||
|
local Objects = {}
|
||
|
|
||
|
local function CreateObjectId()
|
||
|
if Objects then
|
||
|
local objectId = math.random(10000, 99999)
|
||
|
while Objects[objectId] do
|
||
|
objectId = math.random(10000, 99999)
|
||
|
end
|
||
|
return objectId
|
||
|
else
|
||
|
local objectId = math.random(10000, 99999)
|
||
|
return objectId
|
||
|
end
|
||
|
end
|
||
|
|
||
|
QBCore.Functions.CreateUseableItem('emsbag', function(source, item)TriggerClientEvent("Ranjit-EmsBag:Client:spawnLight", source)end)
|
||
|
|
||
|
RegisterNetEvent('Ranjit-EmsBag:Server:SpawnAmbulanceBag', function(type)
|
||
|
local src = source
|
||
|
local objectId = CreateObjectId()
|
||
|
Objects[objectId] = type
|
||
|
TriggerClientEvent("Ranjit-EmsBag:Client:SpawnAmbulanceBag", src, objectId, type, src)
|
||
|
end)
|
||
|
|
||
|
RegisterNetEvent('Ranjit-EmsBag:Server:RemoveItem', function(item, amount)
|
||
|
local src = source
|
||
|
local Player = QBCore.Functions.GetPlayer(src)
|
||
|
Player.Functions.RemoveItem(item, amount)
|
||
|
end)
|
||
|
|
||
|
RegisterNetEvent('Ranjit-EmsBag:Server:AddItem', function(item, amount)
|
||
|
local src = source
|
||
|
local Player = QBCore.Functions.GetPlayer(src)
|
||
|
Player.Functions.AddItem(item, amount)
|
||
|
end)
|
||
|
|
||
|
|