mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
+25
-28
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user