1
0
Fork 0
forked from Simnation/Main
Main/resources/[qb]/Duck_Relog/client.lua
2025-06-27 11:39:45 +02:00

32 lines
923 B
Lua

RegisterCommand("relog", function()
local coords = GetEntityCoords(PlayerPedId())
local heading = GetEntityHeading(PlayerPedId())
TriggerServerEvent("duckrelog:saveCoords", {
x = coords.x,
y = coords.y,
z = coords.z,
w = heading
})
ShutdownLoadingScreenNui()
TriggerEvent("um-multichar:client:chooseChar")
end, false)
-- Wenn Spieler geladen wurde, Position vom Server anfordern
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
TriggerServerEvent("duckrelog:requestCoords")
end)
-- Spieler teleportieren
RegisterNetEvent("duckrelog:setCoords", function(pos)
if pos then
local ped = PlayerPedId()
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
SetEntityCoordsNoOffset(ped, pos.x, pos.y, pos.z, false, false, false)
SetEntityHeading(ped, pos.w or 0.0)
FreezeEntityPosition(ped, false)
end
end)