forked from Simnation/Main
fix
This commit is contained in:
parent
b217c8ff3d
commit
47f6f76107
2 changed files with 30 additions and 33 deletions
|
@ -1,7 +1,7 @@
|
|||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
local savedLocation = nil
|
||||
|
||||
|
||||
-- Relog-Befehl
|
||||
RegisterCommand("relog", function()
|
||||
local ped = PlayerPedId()
|
||||
local coords = GetEntityCoords(ped)
|
||||
|
@ -13,13 +13,12 @@ RegisterCommand("relog", function()
|
|||
return
|
||||
end
|
||||
|
||||
|
||||
|
||||
if IsPedInAnyVehicle(ped, false) then
|
||||
QBCore.Functions.Notify("Du kannst nicht im Fahrzeug relogen", "error")
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
TriggerServerEvent("qb-relogsave:server:saveLocation", playerData.citizenid, {
|
||||
x = coords.x,
|
||||
y = coords.y,
|
||||
|
@ -32,7 +31,19 @@ RegisterCommand("relog", function()
|
|||
Wait(1000)
|
||||
|
||||
|
||||
TriggerServerEvent("qb-relogsave:server:goToMultichar")
|
||||
TriggerEvent("um-multicharacter:client:chooseChar")
|
||||
|
||||
|
||||
Wait(100)
|
||||
TriggerEvent("um-multicharacter:client:openUI")
|
||||
|
||||
|
||||
Wait(100)
|
||||
exports['qb-core']:Logout()
|
||||
|
||||
|
||||
Wait(100)
|
||||
TriggerServerEvent("QBCore:Server:OnPlayerUnload")
|
||||
end, false)
|
||||
|
||||
|
||||
|
@ -47,7 +58,7 @@ end)
|
|||
|
||||
|
||||
RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()
|
||||
Wait(1000) --
|
||||
Wait(1000)
|
||||
RestorePosition()
|
||||
end)
|
||||
|
||||
|
@ -58,6 +69,12 @@ RegisterNetEvent("um-multicharacter:client:spawned", function()
|
|||
end)
|
||||
|
||||
|
||||
RegisterNetEvent("um-multicharacter:client:playerSpawned", function()
|
||||
Wait(1000)
|
||||
RestorePosition()
|
||||
end)
|
||||
|
||||
|
||||
function RestorePosition()
|
||||
if savedLocation then
|
||||
|
||||
|
@ -78,5 +95,3 @@ function RestorePosition()
|
|||
QBCore.Functions.Notify("Position wiederhergestellt", "success")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue