mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2026-11-10 13:57:18 +01:00
Code modernize (#234)
* refactor: declare exports at runtime and drop the player-data provides alias Signed-off-by: Mathu-lmn <[email protected]> * refactor: pass handlers directly to RegisterNetEvent Signed-off-by: Mathu-lmn <[email protected]> * refactor: use CreateThread/Wait without the Citizen prefix Signed-off-by: Mathu-lmn <[email protected]> * chore: remove trailing whitespace, stray lines and unused locals Signed-off-by: Mathu-lmn <[email protected]> --------- Signed-off-by: Mathu-lmn <[email protected]>
This commit is contained in:
@@ -185,9 +185,7 @@ local function freezePlayer(id, freeze)
|
||||
end
|
||||
|
||||
function loadScene(x, y, z)
|
||||
if not NewLoadSceneStart then
|
||||
return
|
||||
end
|
||||
if not NewLoadSceneStart then return end
|
||||
|
||||
NewLoadSceneStart(x, y, z, 0.0, 0.0, 0.0, 20.0, 0)
|
||||
|
||||
@@ -199,13 +197,11 @@ local spawnLock = false
|
||||
|
||||
-- spawns the current player at a certain spawn point index (or a random one, for that matter)
|
||||
function spawnPlayer(spawnIdx, cb)
|
||||
if spawnLock then
|
||||
return
|
||||
end
|
||||
if spawnLock then return end
|
||||
|
||||
spawnLock = true
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- if the spawn isn't set, select a random one
|
||||
if not spawnIdx then
|
||||
spawnIdx = GetRandomIntInRange(1, #spawnPoints + 1)
|
||||
@@ -231,7 +227,7 @@ function spawnPlayer(spawnIdx, cb)
|
||||
DoScreenFadeOut(500)
|
||||
|
||||
while not IsScreenFadedOut() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -302,7 +298,7 @@ function spawnPlayer(spawnIdx, cb)
|
||||
local time = GetGameTimer()
|
||||
|
||||
while (not HasCollisionLoadedAroundEntity(ped) and (GetGameTimer() - time) < 5000) do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
ShutdownLoadingScreen()
|
||||
@@ -311,7 +307,7 @@ function spawnPlayer(spawnIdx, cb)
|
||||
DoScreenFadeIn(500)
|
||||
|
||||
while not IsScreenFadedIn() do
|
||||
Citizen.Wait(0)
|
||||
Wait(0)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -332,10 +328,10 @@ end
|
||||
local respawnForced
|
||||
local diedAt
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
CreateThread(function()
|
||||
-- main loop thing
|
||||
while true do
|
||||
Citizen.Wait(50)
|
||||
Wait(50)
|
||||
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user