forked from Simnation/Main
Merge branch 'master' of https://git.evolution-state-life.de/Evolution-State-Life/Main
This commit is contained in:
commit
ba57f0f054
3 changed files with 85 additions and 73 deletions
|
@ -3,10 +3,11 @@ game 'gta5'
|
|||
|
||||
description 'relog system'
|
||||
author 'Duck'
|
||||
version '1.0.0'
|
||||
version '1.0.1'
|
||||
|
||||
client_script 'client.lua'
|
||||
server_script 'server.lua'
|
||||
|
||||
shared_script '@qb-core/shared/locale.lua'
|
||||
dependency 'qb-core'
|
||||
dependency 'um-multicharacter'
|
||||
|
|
|
@ -1,22 +1,33 @@
|
|||
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
|
||||
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
|
||||
|
||||
TriggerClientEvent("qb-relogsave:client:restoreLocation", Player.PlayerData.source, pos, 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue