SA-MP Forums Archive
Still confused - 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: Still confused (/showthread.php?tid=149289)



Still confused - ViruZZzZ_ChiLLL - 21.05.2010

I'm still confused on how to make a certain skin,
not just spawn at a one place, but spawn randomly
anywhere I set the coords to. But how?


Re: Still confused - DJDhan - 21.05.2010

You can use random() function.

For example:

Код:
new RandomSpawns[][]=
{ SetPlayerPos(playerid,x,y,z.....);//first spawn place
  SetPlayerPos(playerid,x,y,z.....);//second spawn place
  .
  .
  .
  .
 }
Then OnPlayerSpawn or aywhere you want,
Код:
random("RandomSpawns");
There maybe some errors above
You get the idea though don't you


Re: Still confused - ViruZZzZ_ChiLLL - 21.05.2010

Quote:
Originally Posted by DJDhan
You can use random() function.

For example:

Код:
new RandomSpawns[][]=
{ SetPlayerPos(playerid,x,y,z.....);//first spawn place
  SetPlayerPos(playerid,x,y,z.....);//second spawn place
  .
  .
  .
  .
 }
Then OnPlayerSpawn or aywhere you want,
Код:
random("RandomSpawns");
There maybe some errors above
You get the idea though don't you
I already know that, but how can I make it
for a certain skin only?


Re: Still confused - ViruZZzZ_ChiLLL - 21.05.2010

Quote:
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
make the array with the coords in:

new Array[3][3]=
{
{x, y, z},
{x, y, z},
{x, y, z}
}

when they spawn:

new playerskin=GetPlayerSkin(playerid);
if(playerskin == skin to randomly spawn)
{
new r=random(3);
SetPlayerPos(playerid, Array[r][0], Array[r][1], Array[r][2]);
}

hope that helped
Thanks for this But theres a problem :
It only spawns me at a one place, not randomly
anywhere.