forked from Simnation/Main
36 lines
1.3 KiB
Lua
36 lines
1.3 KiB
Lua
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
-- Debug function
|
|
local function Debug(msg)
|
|
if Config.Debug then
|
|
print("[Container Heist] " .. msg)
|
|
end
|
|
end
|
|
|
|
-- Register usable item
|
|
QBCore.Functions.CreateUseableItem(Config.RequiredItems.flex.name, function(source)
|
|
print("Player " .. source .. " used item: " .. Config.RequiredItems.flex.name)
|
|
TriggerClientEvent('container_heist:client:useFlexItem', source)
|
|
end)
|
|
|
|
-- Test robbery event
|
|
RegisterNetEvent('container_heist:server:testRobbery', function(zoneId, zoneType)
|
|
local src = source
|
|
local Player = QBCore.Functions.GetPlayer(src)
|
|
if not Player then return end
|
|
|
|
print("Player " .. src .. " started robbery in zone: " .. zoneId .. " of type: " .. zoneType)
|
|
TriggerClientEvent('QBCore:Notify', src, "Robbery started in zone: " .. zoneId, "success")
|
|
|
|
-- Give a test reward
|
|
exports['tgiann-inventory']:AddItem(src, "cash", 1000)
|
|
TriggerClientEvent('QBCore:Notify', src, "You found $1000!", "success")
|
|
end)
|
|
|
|
-- Print message when resource starts
|
|
AddEventHandler('onResourceStart', function(resourceName)
|
|
if (GetCurrentResourceName() == resourceName) then
|
|
print("^2[Container Heist]^7: Server script started successfully")
|
|
print("^2[Container Heist]^7: Registered usable item: " .. Config.RequiredItems.flex.name)
|
|
end
|
|
end)
|