🚑 Fix random default spawn coords

This commit is contained in:
Gellipapa
2024-05-19 20:07:16 +02:00
parent 1596816465
commit e9a53c6c21
3 changed files with 8 additions and 2 deletions
@@ -23,3 +23,9 @@ function ESX.Math.Trim(value)
return nil
end
end
function ESX.Math.Random(minRange, maxRange)
math.randomseed(GetGameTimer())
return math.random(minRange or 1, maxRange or 10)
end
+1 -1
View File
@@ -239,7 +239,7 @@ function loadESXPlayer(identifier, playerId, isNew)
end
-- Position
userData.coords = json.decode(result.position) or Config.DefaultSpawns[math.random(#Config.DefaultSpawns)]
userData.coords = json.decode(result.position) or Config.DefaultSpawns[ESX.Math.Random(1,#Config.DefaultSpawns)]
-- Skin
userData.skin = (result.skin and result.skin ~= "") and json.decode(result.skin) or { sex = userData.sex == "f" and 1 or 0 }
+1 -1
View File
@@ -1,7 +1,7 @@
local mp_m_freemode_01 = `mp_m_freemode_01`
local mp_f_freemode_01 = `mp_f_freemode_01`
local SpawnCoords = Config.Spawn[math.random(#Config.Spawn)]
local SpawnCoords = Config.Spawn[ESX.Math.Random(1,#Config.Spawn)]
if ESX.GetConfig().Multichar then
CreateThread(function()