SA-MP Forums Archive
help on this... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help on this... (/showthread.php?tid=214248)



help on this... - marinov - 20.01.2011

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 ?


Re: help on this... - blackwave - 20.01.2011

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]);



Re: help on this... - marinov - 20.01.2011

Didn't work =/


Re: help on this... - rjjj - 21.01.2011

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