1
0
Fork 0
forked from Simnation/Main
Main/resources/[qb]/Duck_relogextra/server.lua

35 lines
1.1 KiB
Lua
Raw Normal View History

2025-06-26 06:01:56 +02:00
local savedLocations = {}
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent("qb-relogsave:server:saveLocation", function(cid, coords, heading)
if not cid or not coords then return end
savedLocations[cid] = {
pos = coords,
heading = heading,
timestamp = os.time()
}
print("Position für " .. cid .. " gespeichert: " .. json.encode(coords))
end)
AddEventHandler('QBCore:Server:PlayerLoaded', function(Player)
if not Player or not Player.PlayerData then return end
local cid = Player.PlayerData.citizenid
if savedLocations[cid] then
local pos = savedLocations[cid].pos
local heading = savedLocations[cid].heading
if pos and pos.x and pos.y and pos.z then
TriggerClientEvent("qb-relogsave:client:restoreLocation", Player.PlayerData.source, pos, heading)
print("Position für " .. cid .. " wiederhergestellt")
else
print("Ungültige Position für " .. cid .. " gefunden")
end
savedLocations[cid] = nil
end
end)