1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
EVO 2025-06-26 10:43:40 +02:00
commit 091f200603
60 changed files with 7676 additions and 130 deletions

View file

@ -1,38 +1,38 @@
local QBCore = exports['qb-core']:GetCoreObject()
local savedLocation = nil
RegisterCommand("relog", function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local cid = QBCore.Functions.GetPlayerData().citizenid
-- Speicher Ort vor Relog
TriggerServerEvent("qb-relogsave:server:saveLocation", cid, {
x = coords.x,
y = coords.y,
z = coords.z
}, heading)
TriggerEvent("qb-multicharacter:client:chooseChar")
end, false)
RegisterNetEvent("qb-relogsave:client:restoreLocation", function(pos, heading)
savedLocation = {
pos = pos,
heading = heading
}
end)
RegisterNetEvent("qb-spawn:client:spawned", function()
if savedLocation then
DoScreenFadeOut(500)
Wait(500)
SetEntityCoords(PlayerPedId(), savedLocation.pos.x, savedLocation.pos.y, savedLocation.pos.z)
SetEntityHeading(PlayerPedId(), savedLocation.heading)
Wait(500)
DoScreenFadeIn(500)
savedLocation = nil
end
end)
local QBCore = exports['qb-core']:GetCoreObject()
local savedLocation = nil
RegisterCommand("relog", function()
local ped = PlayerPedId()
local coords = GetEntityCoords(ped)
local heading = GetEntityHeading(ped)
local cid = QBCore.Functions.GetPlayerData().citizenid
-- Speicher Ort vor Relog
TriggerServerEvent("qb-relogsave:server:saveLocation", cid, {
x = coords.x,
y = coords.y,
z = coords.z
}, heading)
TriggerEvent("qb-multicharacter:client:chooseChar")
end, false)
RegisterNetEvent("qb-relogsave:client:restoreLocation", function(pos, heading)
savedLocation = {
pos = pos,
heading = heading
}
end)
RegisterNetEvent("qb-spawn:client:spawned", function()
if savedLocation then
DoScreenFadeOut(500)
Wait(500)
SetEntityCoords(PlayerPedId(), savedLocation.pos.x, savedLocation.pos.y, savedLocation.pos.z)
SetEntityHeading(PlayerPedId(), savedLocation.heading)
Wait(500)
DoScreenFadeIn(500)
savedLocation = nil
end
end)

View file

@ -1,12 +1,13 @@
fx_version 'cerulean'
game 'gta5'
description 'relog system'
author 'Duck'
version '1.0.0'
client_script 'client.lua'
server_script 'server.lua'
shared_script '@qb-core/shared/locale.lua'
dependency 'qb-core'
fx_version 'cerulean'
game 'gta5'
description 'relog system'
author 'Duck'
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'

View file

@ -1,23 +1,34 @@
local savedLocations = {}
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent("qb-relogsave:server:saveLocation", function(cid, coords, heading)
savedLocations[cid] = {
pos = coords,
heading = heading
}
end)
AddEventHandler('QBCore:Server:PlayerLoaded', function(Player)
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)
savedLocations[cid] = nil
end
end)
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)

File diff suppressed because it is too large Load diff