ed
This commit is contained in:
parent
8054759c73
commit
ffaf33c966
7 changed files with 338 additions and 12 deletions
22
resources/[Developer]/[Nordi]/nordi_kayaktrailer/server.lua
Normal file
22
resources/[Developer]/[Nordi]/nordi_kayaktrailer/server.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local trailerKayaks = {}
|
||||
|
||||
-- Event to sync loaded kayaks
|
||||
RegisterNetEvent('kayak_trailer:syncLoadedKayaks', function(trailerNetId, kayakList)
|
||||
local src = source
|
||||
|
||||
-- Store kayaks for this trailer
|
||||
trailerKayaks[trailerNetId] = kayakList
|
||||
|
||||
-- Broadcast to all clients
|
||||
TriggerClientEvent('kayak_trailer:syncLoadedKayaksClient', -1, trailerNetId, kayakList)
|
||||
end)
|
||||
|
||||
-- When a player connects, send them the current state of all trailers
|
||||
RegisterNetEvent('QBCore:Server:PlayerLoaded', function()
|
||||
local src = source
|
||||
|
||||
for trailerNetId, kayakList in pairs(trailerKayaks) do
|
||||
TriggerClientEvent('kayak_trailer:syncLoadedKayaksClient', src, trailerNetId, kayakList)
|
||||
end
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue