random spawn help
#7

Quote:
Originally Posted by funky1234
Посмотреть сообщение
I know you have already found a way to do it, but you can use an array and reduce the effort it takes to complete such a task:

Example:
pawn Код:
enum S_Info{Float:x, Float:y, Float:z, Float:rot}
new Spawn[][S_Info] ={
{x here, y here, z here, rotation here}, //1st Spawn
{x here, y here, z here, rotation here}  // 2nd Spawn etc etc
};

public OnPlayerSpawn(playerid)
{
     new rand = random(sizeof(Spawn));
     SetPlayerPos(playerid, Spawn[rand][x], Spawn[rand][y], Spawn[rand][z]);
     SetPlayerFacingAngle(playerid, Spawn[rand][rot]);
     return 1;
}
It reduces the need for if, else if, else code blocks and makes it easier to edit and add positions.
I find my code easier for editing, but thats me lol
Reply


Messages In This Thread
random spawn help - by Tom1412 - 01.06.2011, 10:57
Re: random spawn help - by Jay. - 01.06.2011, 10:59
Re: random spawn help - by Tom1412 - 01.06.2011, 11:03
Re: random spawn help - by Jay. - 01.06.2011, 11:04
Re: random spawn help - by Ash. - 01.06.2011, 11:23
Re: random spawn help - by Raimis_R - 01.06.2011, 11:27
Re: random spawn help - by Jay. - 01.06.2011, 11:35
Re: random spawn help - by Ash. - 01.06.2011, 13:04

Forum Jump:


Users browsing this thread: 3 Guest(s)