forked from Simnation/Main
fix
This commit is contained in:
parent
d620dd2499
commit
882701a077
2 changed files with 21 additions and 14 deletions
|
@ -1,32 +1,35 @@
|
|||
RegisterCommand("relog", function()
|
||||
local coords = GetEntityCoords(PlayerPedId())
|
||||
local heading = GetEntityHeading(PlayerPedId())
|
||||
local ped = PlayerPedId()
|
||||
local coords = GetEntityCoords(ped)
|
||||
local heading = GetEntityHeading(ped)
|
||||
|
||||
|
||||
-- Position an Server senden
|
||||
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")
|
||||
-- Multichar-Menü öffnen, nachdem der Server Logout durchgeführt hat
|
||||
RegisterNetEvent("duckrelog:openCharMenu", function()
|
||||
ShutdownLoadingScreenNui()
|
||||
TriggerEvent("um-multichar:client:chooseChar")
|
||||
end)
|
||||
|
||||
-- Spieler teleportieren
|
||||
-- Spielerposition wiederherstellen
|
||||
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)
|
||||
|
||||
-- Nach Login, Server fragen ob Position wiederhergestellt werden soll
|
||||
RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()
|
||||
TriggerServerEvent("duckrelog:requestCoords")
|
||||
end)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue