1
0
Fork 0
forked from Simnation/Main
Main/resources/[Developer]/[Nordi]/nordi_kayaktrailer/server.lua
2025-07-09 18:52:29 +02:00

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)