Let me preface this by saying I don't know much about coding. I want to add more spawnpoints to my freeroam server. I found the lua file (I think) that needs to be edited in the Play resource. I've edited it so it looks like this:
addEventHandler("onResourceStart", resourceRoot,
function()
for i,player in ipairs(getElementsByType("player")) do
This has worked to change the spawnpoint to one of the new ones. But it only uses one spawnpoint. I want it to randomly select one. I also want to add more spawnpoints when I get this working.
Question
alwSmokE
Let me preface this by saying I don't know much about coding. I want to add more spawnpoints to my freeroam server. I found the lua file (I think) that needs to be edited in the Play resource. I've edited it so it looks like this:
addEventHandler("onResourceStart", resourceRoot,
function()
for i,player in ipairs(getElementsByType("player")) do
spawn(player)
end
end
)
function spawn(player)
repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(9,288) )
fadeCamera(player, true)
setCameraTarget(player, player)
repeat until spawnPlayer ( player, 2058+math.random(1,5), -3122+math.random(5,9), 18, 90, math.random(9,288) )
fadeCamera(player, true)
setCameraTarget(player, player)
repeat until spawnPlayer ( player, 2017+math.random(1,5), -2540+math.random(5,9), 14, 90, math.random(9,288) )
fadeCamera(player, true)
setCameraTarget(player, player)
end
addEventHandler("onPlayerJoin", root,
function()
spawn(source)
end
)
addEventHandler("onPlayerWasted", root,
function()
setTimer(spawn, 1800, 1, source)
end
)
This has worked to change the spawnpoint to one of the new ones. But it only uses one spawnpoint. I want it to randomly select one. I also want to add more spawnpoints when I get this working.
Any help would be greatly appreciated.
Link to comment
3 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now