kashacters changes

This commit is contained in:
Mycroft
2021-04-06 19:31:26 +01:00
parent 06d19fdb1b
commit 372774b8e4
3 changed files with 60 additions and 29 deletions
+57 -27
View File
@@ -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')
+1
View File
@@ -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
+2 -2
View File
@@ -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()