05.01.2015, 00:13
i want to create team only for member at class selection like Special Guards and spawn can use only member for this team , but i don't know how to create it please who know help me
#define TEAM_A 1 // we will define TEAM_A with id 1
#define TEAM_B 2 // we will define TEAM_B with id 2
static Team[MAX_PLAYERS]; // we will create a variable called Team to check TEAM_A and TEAM_B
public OnGameModeInit()
{
AddPlayerClass(12,Position X,PositionY,PositionZ,Angle,0,0,0,0,0,0); // there we're adding two skins
AddPlayerClass(17,Position X,Position Y,Position Z,Angle,0,0,0,0,0,0);
return true;
}
public OnPlayerRequestClass(playerid, classid)
{
switch(classid)
{
case 0: Team[playerid] = TEAM_A; // so if he choose the first skin (id 12) , he'll be part of TEAM_A
case 1: Team[playerid] = TEAM_B; // so if he choose the second skin (id 17) ,he'll be part of TEAM_B
}
return true;
}
public OnPlayerSpawn(playerid)
{
if(Team[playerid] == TEAM_A)
{
SetPlayerPos(playerid, /*Team Spawn Cords*/); // if the player is of TEAM_A , he'll spawn at X position
return 1;
}
else if(Team[playerid] == TEAM_B)
{
SetPlayerPos(playerid, /*Team Spawn Cords*/); // if the player is of TEAM_B , he'll spawn at X position
return 1;
}
return 1;
}