Team Spawning
#1

Okay at the top of my script i have.

Quote:

#define TEAM_BALLAS ( 0 )
#define TEAM_CJ ( 1 )
new PlayerTeam1[MAX_PLAYERS];
new PlayerTeam2[MAX_PLAYERS];

Then on the player spawn i have this

Код:
public OnPlayerSpawn(playerid)
{
	if(loaded[playerid] == 0)
	{
	    SetTimer("message", 1, false);
		SetPlayerInterior(playerid,0);
		TogglePlayerClock(playerid,0);
		return 1;
	}

	else if(PlayerTeam1[playerid] == 1)
	{
		SetPlayerPos(playerid, 2266.7214,1399.0728,42.8203);
		return 1;
	}
	else if(PlayerTeam2[playerid] == 1)
	{
 		SetPlayerPos(playerid, 2307.9016,1503.1066,10.8234);
		return 1;
		}
	    return 1;
	}
The If Loaded part is just another section of the script but it might be causing some problems.

On the Request spawn i have this

Код:
public OnPlayerRequestClass( playerid, classid ) 
{
    switch ( classid ) 
    {
        case 0: 
        { 
            GameTextForPlayer( playerid, "~r~Army Force", 300, 3 );
            SetPlayerCameraPos(playerid,1828.1793,2781.1021,10.8359);
            SetPlayerCameraLookAt(playerid, 1821.8132,2780.6013,10.8359);
            SetPlayerPos(playerid, 1821.8132,2780.6013,10.8359);
            SetPlayerTeam( playerid, TEAM_BALLAS );
            PlayerTeam1[playerid] = 1;
        }

        case 1: 
        { 
            GameTextForPlayer( playerid, "~g~Attackers", 300, 3 );
            SetPlayerTeam( playerid, TEAM_CJ );
            PlayerTeam2[playerid] = 1;
        }

        case 2: 
        { 
            GameTextForPlayer( playerid, "~g~Attackers", 300, 3 );
            SetPlayerTeam( playerid, TEAM_CJ ); // Sets the player's team to TEAM_CJ
            PlayerTeam2[playerid] = 1;
        }
    }
    return 1; 
}
No this all compiles fine. But it doesn't work. I want the teams to have different spawns but my function "PlayerTeam" Doesn't seem to do that.

Both the teams spawn in the same place.
Would be greatful if you can help +rep thanks
Reply
#2

Maybe it is because in the code you have in OnPlayerRequestClass

lets say you switched from skin 1 to skin 2, you are not changing the playerteam1 variable to 0..so both the variables are 1..which causes them to spawn at the same place
Reply
#3

Okay thanks lots i put

Quote:

PlayerTeam1[playerid] = 0;

and
Quote:

PlayerTeam2[playerid] = 0;

Under the oposite teams, it works now +rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)