SA-MP Forums Archive
Random Spawns.. [fixed] - 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: Random Spawns.. [fixed] (/showthread.php?tid=127613)



Random Spawns.. [fixed] - Lorenc_ - 14.02.2010

Hello everyone i made a random spawn for each teams.

Survivors and zombies..

Код:
new Float:SurvivorSpawn[][4] =
{
  {1830.4221,-1302.7401,138.3944,176.6641},
  {1773.9607,-1302.8594,138.3944,177.2440}
};

new Float:ZombieSpawn[][4] =
{
  {1780.2687,-1305.5575,136.3944,43.8187},
  {1825.1389,-1301.7472,136.3977,354.6717},
  {1673.0095,-1396.1670,84.6563,225.8905},
  {1686.3589,-1422.4753,86.9511,307.6713},
  {1699.7581,-1405.5581,85.3241,359.0584},
  {1687.2373,-1379.6492,88.5904,156.0399}
};
I was wondering how i could make those spawns work for each team..
I tryed once following https://sampwiki.blast.hk/wiki/Random but i've failed..
I'm using gteams if you are wondering.
Thanks in advanced.


Re: Random Spawns.. - ruckfules99 - 14.02.2010

Put this under public OnPlayerSpawn(playerid)


Код:
if (gTeam[playerid] == TEAM_ZOMBIE){ //ADD YOUR OWN gTEAM HERE
    new rnd;
  	SetPlayerFacingAngle(playerid, 88.6658);
 	rnd = random(sizeof (ZombieSpawn));
  	SetPlayerPos(playerid, ZombieSpawn[rnd][0], ZombieSpawn[rnd][1], ZombieSpawn[rnd][2]);
I'm not that good at scripting but that "should" work for your zombie team.


Re: Random Spawns.. - Lorenc_ - 14.02.2010

Fixed it dont worrie ppl..

Quote:
Originally Posted by ruckfules99
Put this under public OnPlayerSpawn(playerid)


Код:
if (gTeam[playerid] == TEAM_ZOMBIE){ //ADD YOUR OWN gTEAM HERE
    new rnd;
  	SetPlayerFacingAngle(playerid, 88.6658);
 	rnd = random(sizeof (ZombieSpawn));
  	SetPlayerPos(playerid, ZombieSpawn[rnd][0], ZombieSpawn[rnd][1], ZombieSpawn[rnd][2]);
I'm not that good at scripting but that "should" work for your zombie team.
I didn't do that way and it worked suprising