02.02.2014, 20:33
Hello i made a COD gamemode but i cant figure out how to make a limit for teams can anyone help me?
and i already found some but i want something simple like this team way anyone that will help will get rep
here is my team code
and i already found some but i want something simple like this team way anyone that will help will get rep
here is my team code
pawn Код:
#define TEAM_GANG 1
#define TEAM_COPS 2
#define TEAM_ARMY 3
#define TEAM_RUSSIA 4
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2516.9578, 2447.6992, 11.0313);
SetPlayerFacingAngle(playerid, 269.7719);
SetPlayerCameraPos(playerid, 2521.2405, 2447.5195, 12.0313);
SetPlayerCameraLookAt(playerid, 2516.9578, 2447.6992, 11.0313);
switch( classid ) // Goes through all of the classid's,faster than an if statement!
{
case 0: // 'classid' zero is our first class, which is going to be assigned to 'TEAM_ONE'
{
SetPlayerTeam( playerid, TEAM_GANG );
// Since TEAM_ONE is defined as '3', this is the same thing as doing:
// SetPlayerTeam( playerid, 3 );
}
case 1: // Let's do the same thing again, but this time, we're assigning it to 'TEAM_TWO'
{
SetPlayerTeam( playerid, TEAM_COPS );
// Once again, this is like doing:
// SetPlayerTeam( playerid, 6 );
}
case 2:
{
SetPlayerTeam(playerid,TEAM_ARMY);
}
case 3:
{
SetPlayerTeam(playerid,TEAM_RUSSIA);
}
}
/*
Alternatively, you could do something with if statements like so:
if( classid == 0 )
{
}
But this method would be slower than using a switch statement.
Remember switch > if statement, if it's between using multiple if statements or a simple switch statement.
*/
return 1;
}
pawn Код:
public OnPlayerSpawn(playerid)
{
if(GetPlayerTeam(playerid) == TEAM_GANG)
{
SetPlayerColor(playerid, COLOR_RED);
GameTextForPlayer(playerid, "~b~OPfor", 1000, 3);
}
else if(GetPlayerTeam(playerid) ==TEAM_COPS)
{
SetPlayerColor(playerid, COLOR_BLUE);
GameTextForPlayer(playerid, "~b~Rangers", 1000, 3);
}
else if(GetPlayerTeam(playerid) == TEAM_ARMY)
{
SetPlayerColor(playerid,COLOR_ORANGE);
GameTextForPlayer(playerid,"~b~Task Force 141",1000,3);
}
else if(GetPlayerTeam(playerid) == TEAM_RUSSIA)
{
SetPlayerColor(playerid,COLOR_RED);
GameTextForPlayer(playerid,"~b~Spetsnaz",1000,3);
}
GivePlayerWeapon(playerid, 23, 250);
GivePlayerWeapon(playerid, 29, 250);
GivePlayerWeapon(playerid, 30, 250);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 999);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
return 1;
}
pawn Код:
stock GetTeamName ( TeamID )
{
new
tName [ 64 ];
// We probably don't even need 64 cells for this, but we will just in case.
switch( TeamID )
{
case TEAM_GANG:
{
tName = "OPfor";
// If their Team ID is TEAM_GANG, then GetTeamName will return "Attackers"
}
case TEAM_COPS:
{
tName = "Rangers";
// If their Team ID is TEAM_COPS, then GetTeamName will return "Defenders"
}
case TEAM_ARMY:
{
tName = "Task Force 141";
}
case TEAM_RUSSIA:
{
tName = "Spetsnaz";
}
default: // Anything but TEAM_ONE or TEAM_TWO.
{
tName = "Unknown";
// If it's unknown ( I'm not sure how this would happen, but I'm sure it's possible.. )
}
}
return tName;
}