Step 1:
Define your teams and give them colours, like:
pawn Код:
#define RUSSIA 1
#define USA 2
.
.
.
so on
#define COLOR_RUSSIA COLOR_BRIGHTRED
#define COLOR_USA COLOR_LIGHTBLUE
.
.
.
so on
Step 2:
Add this :
Step 3:
Add their skins under OnGameModeInit:
pawn Код:
AddPlayerClass(285,-334.5023,1535.5310,75.5625,181.2829,0,0,0,0,0,0); // Russian
AddPlayerClass(287,213.3519,1867.2781,18.3741,359.5766,0,0,0,0,0,0); // United States
Step 4:
The under OnPlayerRequestClass do this:
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 268.4988,1884.0615,-30.0938);
SetPlayerFacingAngle(playerid, 184.2539);
SetPlayerCameraPos(playerid, 268.5090,1880.9513,-30.3906);
SetPlayerCameraLookAt(playerid, 268.4988,1884.0615,-30.0938);
SetPlayerTeamFromClass(playerid, classid);
switch(classid)
{
case 0: GameTextForPlayer(playerid, "~r~RUSSIA", 5000, 3);
case 1: GameTextForPlayer(playerid, "~b~USA", 5000, 3);
}
return 1;
}
This will show the name of the team when you are selecting skins.
Step 5:
The under OnPlayerRequestSpawn do this:
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
{
SetPlayerToTeamColor(playerid);
}
return 1;
}
SetPlayerTeamFromClass(playerid, classid)
{
if(classid == 0)
{
gTeam[playerid] = RUSSIA;
GameTextForPlayer(playerid,"~r~Russia",6,1);
}
if(classid == 1)
{
gTeam[playerid] = USA;
GameTextForPlayer(playerid,"~b~United States",13,1);
}
}
SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == RUSSIA)
{
SetPlayerColor(playerid,COLOR_RUSSIA);
}
if(gTeam[playerid] == USA)
{
SetPlayerColor(playerid,COLOR_USA);
}
}
This will Set the players colour to the team.
Hope you understand this.