SA-MP Forums Archive
Different spawn - 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)
+--- Thread: Different spawn (/showthread.php?tid=349804)



Different spawn - CrazyChoco - 10.06.2012

Hai everyone
i am making a SACNR and i want my cop class to spawn in 3 differnt places, like

LV, LS and SF
Can i get any help ?


AW: Different spawn - Extremo - 10.06.2012

Just use random?

random

Then you can define three different spawns and depending on the random result you spawn them at each one of them. You can't spawn someone at three places at the same time anyway


Re: Different spawn - CrazyChoco - 10.06.2012

yea i mean random ofcourse else the cop guy have to bwe splitted iin 3 :P

Thanks


Re: Different spawn - CrazyChoco - 10.06.2012

i got it compiled, but when i use /kill to test each city with cop i just spawn random places like where civilian shall spawn etc


Re: Different spawn - StrangeLove - 10.06.2012

You have to set teams.


Re: Different spawn - CrazyChoco - 10.06.2012

like how?


Re: Different spawn - CrazyChoco - 10.06.2012

Anyone??


Re: Different spawn - leonardo1434 - 10.06.2012

pawn Код:
new spawn[4] = { // you will just create new spawn's for each teams with different position's.
    cords,
    cords1,
    cords2,
    cords3,
};
new Teamspawn[2] = { // TEAM SPAWN...
    cords,
    cords1,
};

public OnPlayerSpawn(playerid)
{
   SetPlayerPos(playerid,spawn[random(sizeof(spawn)]);
}
//if you wish to teams..
   
public OnPlayerSpawn(playerid)
{
   if(gTeam == 1) // this can be different in your gm...
   {
      SetPlayerPos(playerid,Teamspawn[random(sizeof(Teamspawn)]);
   }
   // and so on...
}



Re: Different spawn - CrazyChoco - 10.06.2012

Thanks


Re: Different spawn - CrazyChoco - 10.06.2012

i am getting those 3 errors:
Quote:

C:\Users\Kajinth Thaas\Desktop\SACNR\gamemodes\SACNR.pwn(3222) : error 008: must be a constant expression; assumed zero
C:\Users\Kajinth Thaas\Desktop\SACNR\gamemodes\SACNR.pwn(3233) : error 033: array must be indexed (variable "gTeam")
C:\Users\Kajinth Thaas\Desktop\SACNR\gamemodes\SACNR.pwn(3235) : error 001: expected token: ",", but found "]"

and my code for it is

Quote:

new Teamspawn[3] = { // TEAM SPAWN...
{1568.2250,-1693.5483,5.8906,177.0983},
{-1604.8442,732.9442,-5.2344,37.6041},
{2343.4553,2455.5994,14.9688,96.5022}
};



public OnPlayerSpawn(playerid)
{


if(gTeam == TEAM_COPS) // this can be different in your gm...
{
SetPlayerPos(playerid,Teamspawn[random(sizeof(Teamspawn)]);
}