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()
|
RegisterCommand("relog", function()
|
||||||
local coords = GetEntityCoords(PlayerPedId())
|
local ped = PlayerPedId()
|
||||||
local heading = GetEntityHeading(PlayerPedId())
|
local coords = GetEntityCoords(ped)
|
||||||
|
local heading = GetEntityHeading(ped)
|
||||||
|
|
||||||
|
-- Position an Server senden
|
||||||
TriggerServerEvent("duckrelog:saveCoords", {
|
TriggerServerEvent("duckrelog:saveCoords", {
|
||||||
x = coords.x,
|
x = coords.x,
|
||||||
y = coords.y,
|
y = coords.y,
|
||||||
z = coords.z,
|
z = coords.z,
|
||||||
w = heading
|
w = heading
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
ShutdownLoadingScreenNui()
|
|
||||||
TriggerEvent("um-multichar:client:chooseChar")
|
|
||||||
end, false)
|
end, false)
|
||||||
|
|
||||||
-- Wenn Spieler geladen wurde, Position vom Server anfordern
|
-- Multichar-Menü öffnen, nachdem der Server Logout durchgeführt hat
|
||||||
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
|
RegisterNetEvent("duckrelog:openCharMenu", function()
|
||||||
TriggerServerEvent("duckrelog:requestCoords")
|
ShutdownLoadingScreenNui()
|
||||||
|
TriggerEvent("um-multichar:client:chooseChar")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Spieler teleportieren
|
-- Spielerposition wiederherstellen
|
||||||
RegisterNetEvent("duckrelog:setCoords", function(pos)
|
RegisterNetEvent("duckrelog:setCoords", function(pos)
|
||||||
if pos then
|
if pos then
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
|
RequestCollisionAtCoord(pos.x, pos.y, pos.z)
|
||||||
SetEntityCoordsNoOffset(ped, pos.x, pos.y, pos.z, false, false, false)
|
SetEntityCoordsNoOffset(ped, pos.x, pos.y, pos.z, false, false, false)
|
||||||
SetEntityHeading(ped, pos.w or 0.0)
|
SetEntityHeading(ped, pos.w or 0.0)
|
||||||
FreezeEntityPosition(ped, false)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Nach Login, Server fragen ob Position wiederhergestellt werden soll
|
||||||
|
RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()
|
||||||
|
TriggerServerEvent("duckrelog:requestCoords")
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
|
@ -8,15 +8,19 @@ RegisterServerEvent("duckrelog:saveCoords", function(pos)
|
||||||
-- Spieler korrekt abmelden
|
-- Spieler korrekt abmelden
|
||||||
QBCore.Player.Logout(src)
|
QBCore.Player.Logout(src)
|
||||||
|
|
||||||
-- RoutingBucket auf 0 setzen
|
-- RoutingBucket zurücksetzen
|
||||||
SetPlayerRoutingBucket(src, 0)
|
SetPlayerRoutingBucket(src, 0)
|
||||||
|
|
||||||
|
-- Client auffordern, Char-Menü zu öffnen
|
||||||
|
TriggerClientEvent("duckrelog:openCharMenu", src)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterServerEvent("duckrelog:requestCoords", function()
|
RegisterServerEvent("duckrelog:requestCoords", function()
|
||||||
local src = source
|
local src = source
|
||||||
local pos = LastPositions[src]
|
local pos = LastPositions[src]
|
||||||
|
|
||||||
if pos then
|
if pos then
|
||||||
TriggerClientEvent("duckrelog:setCoords", src, pos)
|
TriggerClientEvent("duckrelog:setCoords", src, pos)
|
||||||
LastPositions[src] = nil -- nach der Verwendung löschen
|
LastPositions[src] = nil
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue