Team Death Match
#1

I need to find out how to make Teams spawn at different place's and random spawn....
(-1385.2020,507.8355,18.2294,81.0479,0,0,0,0,0,0); // Red Team Spawn
(147.8706,2501.1167,16.4844,287.1192,0,0,0,0,0,0); // Blue Team Spawn
Reply
#2

pawn Code:
new
    Float:gRandomSpawn[maxspawnsinhere][3] =
    {
         {0.0, 0.0, 0.0},
         {0.0, 0.0, 0.0}
    };

//onplayerspawn
new iRandom = random( sizeof( gRandomSpawn ));
SetPlayerPos( playerid, gRandomSpawn[iRandom][0], gRandomSpawn[iRandom][1], gRandomSpawn[iRandom][2] );
That is an easy code which will spawn player at one of the coords you added in the variable (randomly chosen).


Onplayerspawn, to make teams spawn at different places, just do a check if he's a blue or red player, then spawn him on the correct location.
Reply
#3

pawn Code:
if (gTeam[playerid] == TEAM_RED);
{
SetPlayerPos(playerid,-1385.2020,507.8355,18.2294,81.0479);
}
if (gTeam[playerid]) == TEAM_BLUE);
{
SetPlayerPos(playerid,147.8706,2501.1167,16.4844,287.1192);
}
ok try this
put this in OnPlayerSpawn
its untested done from my head (as i have not got pawn on this computer and i will put correction to this as i get back to my computer if i done something wrong )
EDIT: someone was faster ... xD
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=346614
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)