[MTA]Weed Posted August 13, 2017 Share Posted August 13, 2017 function FreeroamRespawn(player) if not isElement(player) then return end local element = getElementParent(player) if getElementData(player, "state") ~= "Waiting" then return end repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(312), 0, 0) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) toggleAllControls(player, true, true, true) end the first works perfectly but has only 1 spawn locaion, but when i try adding more spawn points it dont work,my gamemode crashes what am i missing? the code below i used to adding more spawn locations. function spawn(player) local spawns = { } spawns[1] = { } spawns[1].x = -2030.1610107422 spawns[1].y = 172.25221252441 spawns[1].z = 28.8359375 spawns[1].rot = 90.0 spawns[2] = { } spawns[2].x = 423.2495 spawns[2].y = 453.2564 spawns[2].z = 564.6321 spawns[2].rot = 120.6928 local rnd = math.random( #spawns ) spawnPlayer( player, spawns[rnd].x, spawns[rnd].y, spawns[rnd].z, spawns[rnd].rot ) end Link to comment
MIKI785 Posted August 14, 2017 Share Posted August 14, 2017 That repeat loop makes no sense, you're not repeating anything and it will always pass the first time.. so It's like it's not even there. I don't see anything wrong the the spawn function, so just use this instead: function FreeroamRespawn(player) if not isElement(player) then return end local element = getElementParent(player) if getElementData(player, "state") ~= "Waiting" then return end spawn(player) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) toggleAllControls(player, true, true, true) end Link to comment
[MTA]Weed Posted August 16, 2017 Author Share Posted August 16, 2017 spawn is working good, my problem is i cant add more spawn points Link to comment
_DrXenon Posted August 16, 2017 Share Posted August 16, 2017 Adding spawn points will be through adding more spawns in the main table. Could you present the way you add more spawns into the table so we can know if you doing it right? Link to comment
[MTA]Weed Posted August 16, 2017 Author Share Posted August 16, 2017 local spawns = { } spawns[1] = { } spawns[1].x = -2030.1610107422 spawns[1].y = 172.25221252441 spawns[1].z = 28.8359375 spawns[1].rot = 90.0 spawns[2] = { } spawns[2].x = 423.2495 spawns[2].y = 453.2564 spawns[2].z = 564.6321 spawns[2].rot = 120.6928 local rnd = math.random( #spawns ) spawnPlayer( player, spawns[rnd].x, spawns[rnd].y, spawns[rnd].z, spawns[rnd].rot ) Link to comment
Electro88 Posted August 16, 2017 Share Posted August 16, 2017 local spawns = { { -2030.1610107422, 172.25221252441, 28.8359375, 90.0 }, { 423.2495, 453.2564, 564.6321, 120.6928 } } local rnd = math.random( #spawns ) spawnPlayer( player, spawns[rnd][1], spawns[rnd][2], spawns[rnd][3], spawns[rnd][4]) 1 1 Link to comment
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