22.02.2012, 22:33
(
Последний раз редактировалось Steeve_Smith; 22.02.2012 в 23:06.
)
You need to declare that after your main() function: gTeam[MAX_PLAYERS];
Now OnPlayerRequestClass(), you will have to setup the two teams.
Now we will be setting the anti-teamkill, and give weapons
Sorry for my indentation, Tab hasn't got the same function on Firefox, just don't forget to indent your code :P
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
}
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);
}
}