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 QBCore = exports['qb-core']:GetCoreObject()
|
||||||
local savedLocation = nil
|
local savedLocation = nil
|
||||||
|
|
||||||
|
-- Relog-Befehl
|
||||||
RegisterCommand("relog", function()
|
RegisterCommand("relog", function()
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
local coords = GetEntityCoords(ped)
|
local coords = GetEntityCoords(ped)
|
||||||
|
@ -19,7 +19,6 @@ RegisterCommand("relog", function()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
TriggerServerEvent("qb-relogsave:server:saveLocation", playerData.citizenid, {
|
TriggerServerEvent("qb-relogsave:server:saveLocation", playerData.citizenid, {
|
||||||
x = coords.x,
|
x = coords.x,
|
||||||
y = coords.y,
|
y = coords.y,
|
||||||
|
@ -32,7 +31,19 @@ RegisterCommand("relog", function()
|
||||||
Wait(1000)
|
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)
|
end, false)
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +58,7 @@ end)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()
|
RegisterNetEvent("QBCore:Client:OnPlayerLoaded", function()
|
||||||
Wait(1000) --
|
Wait(1000)
|
||||||
RestorePosition()
|
RestorePosition()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@ -58,6 +69,12 @@ RegisterNetEvent("um-multicharacter:client:spawned", function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
RegisterNetEvent("um-multicharacter:client:playerSpawned", function()
|
||||||
|
Wait(1000)
|
||||||
|
RestorePosition()
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
function RestorePosition()
|
function RestorePosition()
|
||||||
if savedLocation then
|
if savedLocation then
|
||||||
|
|
||||||
|
@ -78,5 +95,3 @@ function RestorePosition()
|
||||||
QBCore.Functions.Notify("Position wiederhergestellt", "success")
|
QBCore.Functions.Notify("Position wiederhergestellt", "success")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,34 +34,16 @@ RegisterNetEvent('QBCore:Server:OnPlayerLoaded', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
||||||
RegisterNetEvent("qb-relogsave:server:goToMultichar", function()
|
RegisterNetEvent('um-multicharacter:server:CharacterLoaded', function()
|
||||||
local src = source
|
local src = source
|
||||||
|
local Player = QBCore.Functions.GetPlayer(src)
|
||||||
|
|
||||||
|
if not Player then return end
|
||||||
|
|
||||||
|
local cid = Player.PlayerData.citizenid
|
||||||
|
|
||||||
TriggerClientEvent('um-multicharacter:client:chooseChar', src)
|
if savedLocations[cid] then
|
||||||
|
TriggerClientEvent("qb-relogsave:client:restoreLocation", src, savedLocations[cid].pos, savedLocations[cid].heading)
|
||||||
|
savedLocations[cid] = nil
|
||||||
Citizen.SetTimeout(500, function()
|
end
|
||||||
|
|
||||||
if GetPlayerPing(src) > 0 then
|
|
||||||
|
|
||||||
local Player = QBCore.Functions.GetPlayer(src)
|
|
||||||
if Player then
|
|
||||||
|
|
||||||
Player.Functions.Save()
|
|
||||||
|
|
||||||
|
|
||||||
TriggerClientEvent('qb-multicharacter:client:chooseChar', src)
|
|
||||||
TriggerEvent("um-multicharacter:server:loadUserData", src)
|
|
||||||
|
|
||||||
|
|
||||||
Citizen.SetTimeout(500, function()
|
|
||||||
if GetPlayerPing(src) > 0 then
|
|
||||||
DropPlayer(src, "Relog wird durchgeführt... Bitte erneut verbinden.")
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue