help on this...
#1

I need something like this :

pawn Код:
new Float:RandomPlayerSpawns = {
{376, -2034, 7.83};
{613, -1775, 14.31};
{647, -1645, 15.047};
{736, -1386, 13.7};
{833, -1761, 13.6};
}

how do I make it work ?
Reply
#2

pawn Код:
new Float:RandomPlayerSpawns[][6] = {
{376, -2034, 7.83};
{613, -1775, 14.31};
{647, -1645, 15.047};
{736, -1386, 13.7};
{833, -1761, 13.6};
}

On the OnPlayerSpawn:
pawn Код:
new rand = random(sizeof(RandomPlayerSpawns));
SetPlayerPos(playerid,RandomPlayerSpawns[random][0],RandomPlayerSpawns[random][1],RandomPlayerSpawns[random][2]);
Reply
#3

Didn't work =/
Reply
#4

Here:

pawn Код:
//Put it in the top of your GameMode:

new Float:RandomPlayerSpawns[6][3] = {//Change the 6 to the max coordinates that you have in the variable
{376,-2034,7.83},
{376, -2034, 7.83},
{613, -1775, 14.31},
{647, -1645, 15.047},
{736, -1386, 13.7},
{833, -1761, 13.6} //You can't put a comma in the last coordinate
};

And use it in the OnPlayerSpawn callback:

pawn Код:
new rand = random(sizeof(RandomPlayerSpawns));
SetPlayerPos(playerid,RandomPlayerSpawns[random][0],RandomPlayerSpawns[random][1],RandomPlayerSpawns[random][2]);

I hope that i have helped
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)