forked from Simnation/Main
22 lines
762 B
Lua
22 lines
762 B
Lua
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)
|