Revert "d"

This reverts commit 1036043629.
This commit is contained in:
Mycroft
2021-04-06 22:57:03 +01:00
parent 1036043629
commit c31f1c62b1
2 changed files with 35 additions and 56 deletions
+25 -28
View File
@@ -1,12 +1,7 @@
local isPaused, isDead, pickups = false, false, {}
if Config.UseKashacters then
RegisterNetEvent('esx:kashloaded')
AddEventHandler('esx:kashloaded', function()
TriggerServerEvent('esx:onPlayerJoined')
end)
else
Citizen.CreateThread(function()
if not Config.UseKashacters then
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
@@ -17,6 +12,11 @@ else
end
end
end)
else
RegisterNetEvent('esx:kashloaded')
AddEventHandler('esx:kashloaded', function()
TriggerServerEvent('esx:onPlayerJoined')
end)
end
RegisterNetEvent('esx:playerLoaded')
@@ -25,7 +25,6 @@ AddEventHandler('esx:playerLoaded', function(playerData)
ESX.PlayerData = playerData
-- check if player is coming from loading screen
if not Config.UseKashacters then
if GetEntityModel(PlayerPedId()) == GetHashKey('PLAYER_ZERO') then
local defaultModel = GetHashKey('a_m_y_stbla_02')
RequestModel(defaultModel)
@@ -39,7 +38,6 @@ if not Config.UseKashacters then
SetPedRandomComponentVariation(PlayerPedId(), true)
SetModelAsNoLongerNeeded(defaultModel)
end
end
-- freeze the player
FreezeEntityPosition(PlayerPedId(), true)
@@ -70,6 +68,7 @@ if not Config.UseKashacters then
})
end
local wait = 4000
if Config.UseKashacters then
--[[
ESX.Game.Teleport(PlayerPedId(), {
@@ -90,30 +89,28 @@ ShutdownLoadingScreen()
FreezeEntityPosition(PlayerPedId(), false)
DoScreenFadeIn(0)
StartServerSyncLoops()
TriggerEvent('esx:loadingScreenOff')
else
ESX.Game.Teleport(PlayerPedId(), {
x = playerData.coords.x,
y = playerData.coords.y,
z = playerData.coords.z + 0.25,
heading = playerData.coords.heading
else
ESX.Game.Teleport(PlayerPedId(), {
x = playerData.coords.x,
y = playerData.coords.y,
z = playerData.coords.z + 0.25,
heading = playerData.coords.heading
}, function()
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
TriggerEvent('esx:restoreLoadout')
TriggerServerEvent('esx:onPlayerSpawn')
TriggerEvent('esx:onPlayerSpawn')
TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon
TriggerEvent('esx:restoreLoadout')
Citizen.Wait(4000)
ShutdownLoadingScreen()
ShutdownLoadingScreenNui()
FreezeEntityPosition(PlayerPedId(), false)
DoScreenFadeIn(10000)
StartServerSyncLoops()
Citizen.Wait(3000)
ShutdownLoadingScreen()
FreezeEntityPosition(PlayerPedId(), false)
DoScreenFadeIn(10000)
StartServerSyncLoops()
TriggerEvent('esx:loadingScreenOff')
end)
TriggerEvent('esx:loadingScreenOff')
end)
end
RegisterNetEvent('esx:setMaxWeight')
AddEventHandler('esx:setMaxWeight', function(newMaxWeight) ESX.PlayerData.maxWeight = newMaxWeight end)
+10 -28
View File
@@ -13,21 +13,12 @@ end)
function onPlayerJoined(playerId)
local identifier
if not Config.UseKashacters then
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
else
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = v
break
end
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
end
if identifier then
if ESX.GetPlayerFromIdentifier(identifier) then
@@ -64,20 +55,11 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
local playerId, identifier = source
Citizen.Wait(100)
if not Config.UseKashacters then
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
else
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = v
break
end
end
for k,v in ipairs(GetPlayerIdentifiers(playerId)) do
if string.match(v, 'license:') then
identifier = string.sub(v, 9)
break
end
end
if identifier then