Fix Script
This commit is contained in:
parent
de9c6aeb91
commit
04949225df
3 changed files with 85 additions and 0 deletions
34
resources/[qb]/Duck_relogextra/server.lua
Normal file
34
resources/[qb]/Duck_relogextra/server.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
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)
|
Loading…
Add table
Add a link
Reference in a new issue