diff --git a/[core]/esx_multicharacter/client/main.lua b/[core]/esx_multicharacter/client/main.lua index 901acbc3..90677046 100644 --- a/[core]/esx_multicharacter/client/main.lua +++ b/[core]/esx_multicharacter/client/main.lua @@ -1,5 +1,8 @@ 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)] + if ESX.GetConfig().Multichar then CreateThread(function() @@ -28,14 +31,14 @@ if ESX.GetConfig().Multichar then spawned = false cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true) local playerPed = PlayerPedId() - SetEntityCoords(playerPed, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z, true, false, false, false) - SetEntityHeading(playerPed, Config.Spawn.w) + SetEntityCoords(playerPed, SpawnCoords.x, SpawnCoords.y, SpawnCoords.z, true, false, false, false) + SetEntityHeading(playerPed, SpawnCoords.w) local offset = GetOffsetFromEntityInWorldCoords(playerPed, 0, 1.7, 0.4) DoScreenFadeOut(0) SetCamActive(cam, true) RenderScriptCams(true, false, 1, true, true) SetCamCoord(cam, offset.x, offset.y, offset.z) - PointCamAtCoord(cam, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z + 1.3) + PointCamAtCoord(cam, SpawnCoords.x, SpawnCoords.y, SpawnCoords.z + 1.3) StartLoop() ShutdownLoadingScreen() ShutdownLoadingScreenNui() @@ -98,10 +101,10 @@ if ESX.GetConfig().Multichar then SetupCharacter = function(index) if not spawned then exports.spawnmanager:spawnPlayer({ - x = Config.Spawn.x, - y = Config.Spawn.y, - z = Config.Spawn.z, - heading = Config.Spawn.w, + x = SpawnCoords.x, + y = SpawnCoords.y, + z = SpawnCoords.z, + heading = SpawnCoords.w, model = Characters[index].model or mp_m_freemode_01, skipFade = true }, function() @@ -242,10 +245,10 @@ if ESX.GetConfig().Multichar then action = "closeui" }) exports.spawnmanager:spawnPlayer({ - x = Config.Spawn.x, - y = Config.Spawn.y, - z = Config.Spawn.z, - heading = Config.Spawn.w, + x = SpawnCoords.x, + y = SpawnCoords.y, + z = SpawnCoords.z, + heading = SpawnCoords.w, model = mp_m_freemode_01, skipFade = true }, function() diff --git a/[core]/esx_multicharacter/config.lua b/[core]/esx_multicharacter/config.lua index 9a2cb18f..f8256d38 100644 --- a/[core]/esx_multicharacter/config.lua +++ b/[core]/esx_multicharacter/config.lua @@ -16,7 +16,9 @@ if IsDuplicityVersion() then else -- Sets the location for the character selection scene -- To set the spawn location for new characters, modify the default value in the users SQL table - Config.Spawn = vector4(-284.2856, 562.4627, 172.9182, 19.9895) + Config.Spawn = { + {x = -284.2856, y = 562.4627, z = 172.9182, heading = 19.9895}, + } -------------------- -- Do not use unless you are prepared to adjust your resources to correctly reset data