diff --git a/client/main.lua b/client/main.lua index 1ab413e2..737384c4 100644 --- a/client/main.lua +++ b/client/main.lua @@ -1,15 +1,23 @@ local isPaused, isDead, pickups = false, false, {} -Citizen.CreateThread(function() - while true do - Citizen.Wait(0) +if not Config.UseKashacters then + Citizen.CreateThread(function() - if NetworkIsPlayerActive(PlayerId()) then - TriggerServerEvent('esx:onPlayerJoined') - break - end - end -end) + while true do + Citizen.Wait(0) + + if NetworkIsPlayerActive(PlayerId()) then + TriggerServerEvent('esx:onPlayerJoined') + break + end + end + end) +else + RegisterNetEvent('esx:kashloaded') + AddEventHandler('esx:kashloaded', function() + TriggerServerEvent('esx:onPlayerJoined') + end) +end RegisterNetEvent('esx:playerLoaded') AddEventHandler('esx:playerLoaded', function(playerData) @@ -22,7 +30,7 @@ AddEventHandler('esx:playerLoaded', function(playerData) RequestModel(defaultModel) while not HasModelLoaded(defaultModel) do - Citizen.Wait(10) + Citizen.Wait(25) end SetPlayerModel(PlayerId(), defaultModel) @@ -60,26 +68,48 @@ AddEventHandler('esx:playerLoaded', function(playerData) }) end - ESX.Game.Teleport(PlayerPedId(), { - x = playerData.coords.x, - y = playerData.coords.y, - z = playerData.coords.z + 0.25, - heading = playerData.coords.heading + local wait = 4000 +if Config.UseKashacters then +--[[ + ESX.Game.Teleport(PlayerPedId(), { + x = playerData.coords.x, + y = playerData.coords.y, + z = playerData.coords.z + 0.25, + heading = playerData.coords.heading + }, function() + end) +]]-- +TriggerServerEvent('esx:onPlayerSpawn') +TriggerEvent('esx:onPlayerSpawn') +TriggerEvent('playerSpawned') -- compatibility with old scripts, will be removed soon +TriggerEvent('esx:restoreLoadout') + +Citizen.Wait(0) +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 }, 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) RegisterNetEvent('esx:setMaxWeight') diff --git a/config.lua b/config.lua index 93e400db..85b95982 100644 --- a/config.lua +++ b/config.lua @@ -14,3 +14,4 @@ Config.EnableHud = true -- enable the default hud? Display current jo Config.MaxWeight = 24 -- the max inventory weight without backpack Config.PaycheckInterval = 7 * 60000 -- how often to recieve pay checks in milliseconds Config.EnableDebug = false +Config.UseKashacters = false \ No newline at end of file diff --git a/server/functions.lua b/server/functions.lua index eca0a20d..866f8b7b 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -211,10 +211,10 @@ end ESX.StartDBSync = function() function saveData() ESX.SavePlayers() - SetTimeout(10 * 60 * 1000, saveData) + SetTimeout(15 * 60 * 1000, saveData) end - SetTimeout(10 * 60 * 1000, saveData) + SetTimeout(15 * 60 * 1000, saveData) end ESX.GetPlayers = function()