Teams.
#4

You need to declare that after your main() function: gTeam[MAX_PLAYERS];

Now OnPlayerRequestClass(), you will have to setup the two teams.

pawn Код:
OnPlayerRequestClass()
{
    switch(classid) // Switch for the skins
    {  
        case 0..1: // In case that the player is gonna choose the first or second
        {
            gTeam[playerid] = TEAM_GROVE; // Will affect the player to the team 'TEAM_GROVE'
            GameTextForPlayer(playerid, "~g~GROVE ~w~TEAM", 2000, 5); // We show the player the message
        }
        case 2..3: // In case that the player is gonna choose the third or fourth skin
        {
            gTeam[playerid] = TEAM_BALLAS; //  Will affect the player to the team 'TEAM_BALLAS
            GameTextForPlayer(playerid, "~r~BALLAS ~w~TEAM", 2000, 5); // We show the player the message
        }
Now we will be setting the anti-teamkill, and give weapons

pawn Код:
public OnPlayerSpawn(playerid)
{
    if(gTeam[playerid] == TEAM_RED) // If the player team is TEAM_RED
    {
        SetPlayerTeam(playerid, 1); // We set his team to 1 for the script, to be sure that a player of the team 1 cannot kill a player of the team 1
        SetPlayerColor(playerid, COLOR_RED); // We set his color to red
        GivePlayerWeapon(playerid, 5, 1); // We give the player's weapon
        }
    if(gTeam[playerid] == TEAM_GREEN)
   {
            SetPlayerTeam(playerid, 2);      
            SetPlayerColor(playerid, COLOR_GREEN);
            GivePlayerWeapon(playerid, 5, 1);
        }
}
Sorry for my indentation, Tab hasn't got the same function on Firefox, just don't forget to indent your code :P
Reply


Messages In This Thread
Teams. - by Blunt - 22.02.2012, 20:31
Re: Teams. - by IceCube! - 22.02.2012, 20:35
Re: Teams. - by Blunt - 22.02.2012, 20:41
Re : Teams. - by Steeve_Smith - 22.02.2012, 22:33
Re: Teams. - by Blunt - 23.02.2012, 18:47

Forum Jump:


Users browsing this thread: 1 Guest(s)