ice_brasil Posted May 21, 2013 Share Posted May 21, 2013 function SpawnPlayer(thePlayer,skin,skin2,skin3,r,g,b) local n = math.random(1,3) if n == 1 then spawnPlayer ( thePlayer, -1494,921,8, 90.0, skin ) spawnPlayer ( thePlayer, 2005,1545,14, 90.0, skin3 ) else spawnPlayer ( thePlayer, 1178,-1325,15, 90.0, skin2 ) end want by for a player spawn in random place,the player comes in only two coordinates What did this wrong? second doubt function PlayerRespawn(diedPlayer) if not diedPlayer then else toggleAllControls(diedPlayer,true) setPlayerMoney(diedPlayer,StartMoney) spawnPlayer ( diedPlayer, 1539.7673339844,-1352.8256835938,329.46545410156, 90.0,playerSkin[diedPlayer][1]) setCameraTarget (diedPlayer, diedPlayer) end end I want when a player dies he is born in a coordinated random What did this wrong? Link to comment
iPrestege Posted May 21, 2013 Share Posted May 21, 2013 I didn't understand what are you trying to do can you explain more clear? Link to comment
ice_brasil Posted May 21, 2013 Author Share Posted May 21, 2013 I made a system for when the player is born he is born in a random coordinate That is one of 3 that I made at the beginning function SpawnPlayer(thePlayer,skin,skin2,skin3,r,g,b) local n = math.random(1,3) if n == 1 then spawnPlayer ( thePlayer, -1494,921,8, 90.0, skin ) spawnPlayer ( thePlayer, 2005,1545,14, 90.0, skin3 ) else spawnPlayer ( thePlayer, 1178,-1325,15, 90.0, skin2 ) end But the player is not born at random What do I switch to when he spawn spawn random Link to comment
iPrestege Posted May 21, 2013 Share Posted May 21, 2013 You aren't make a much sense create a table and get the values and make a random spawn . Link to comment
Jacob Lenn Posted May 21, 2013 Share Posted May 21, 2013 function SpawnPlayer(thePlayer,skin,skin2,skin3,r,g,b) local n = math.random(1,3) if n == 1 then spawnPlayer ( thePlayer, -1494,921,8, 90.0, skin ) elseif n == 2 then spawnPlayer ( thePlayer, 2005,1545,14, 90.0, skin3 ) elseif n == 3 then spawnPlayer ( thePlayer, 1178,-1325,15, 90.0, skin2 ) end end Link to comment
ice_brasil Posted May 21, 2013 Author Share Posted May 21, 2013 Jacob works and when you die spawn in random coordinate ? function PlayerRespawn(diedPlayer) if not diedPlayer then else toggleAllControls(diedPlayer,true) setPlayerMoney(diedPlayer,StartMoney) spawnPlayer ( diedPlayer, 1539.7673339844,-1352.8256835938,329.46545410156, 90.0,playerSkin[diedPlayer][1]) setCameraTarget (diedPlayer, diedPlayer) end end Link to comment
iPrestege Posted May 21, 2013 Share Posted May 21, 2013 If you want a easy way to get a random spawns make a table . 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