Random Spawn Location

help

#1

Hello. Is there a way to add more random spawn locations to this script? Thanks!


local cfg = {}

-- define the first spawn position/radius of the player (very first spawn on the server, or after death)
cfg.spawn_enabled = true -- set to false to disable the feature
cfg.spawn_position = {-266.07498168945,-961.10437011719,31.223129272461}
cfg.spawn_radius = 1

-- customization set when spawning for the first time
-- see https://wiki.fivem.net/wiki/Peds
-- mp_m_freemode_01 (male)
-- mp_f_freemode_01 (female)
cfg.default_customization = {
  model = "mp_m_freemode_01" 
}

-- init default ped parts
for i=0,19 do
  cfg.default_customization[i] = {0,0}
end

cfg.clear_phone_directory_on_death = false
cfg.lose_aptitudes_on_death = false

return cfg
 -- {1151.2432861328,-1526.7790527344,34.843448638916}

#2

Bump. Can anyone help me?


#3

What is this script and what do you mean by adding more location


#4

Dunko vRP. I want more random coordinates to be added as a spawn location but I do not know how to add them. I have a few coordinates I want to add.


#5

Haven’t tested, but here:

Code
local cfg = {}

local positions = {
{-266.07498168945,-961.10437011719,31.223129272461},
{-266.07498168945,-961.10437011719,31.223129272461} -- Change this    if adding more remember the ,
}

-- define the first spawn position/radius of the player (very first spawn on the server, or after death)
cfg.spawn_enabled = true -- set to false to disable the feature
cfg.spawn_radius = 1

local rn = math.random(1, #positions)
cfg.spawn_position = positions[rn]

-- customization set when spawning for the first time
-- see https://wiki.fivem.net/wiki/Peds
-- mp_m_freemode_01 (male)
-- mp_f_freemode_01 (female)
cfg.default_customization = {
  model = "mp_m_freemode_01" 
}

-- init default ped parts
for i=0,19 do
  cfg.default_customization[i] = {0,0}
end

cfg.clear_phone_directory_on_death = false
cfg.lose_aptitudes_on_death = false

return cfg
 -- {1151.2432861328,-1526.7790527344,34.843448638916}