This commit is contained in:
Nordi98 2025-07-09 18:52:29 +02:00
parent 8054759c73
commit ffaf33c966
7 changed files with 338 additions and 12 deletions

View 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)