SA-MP Forums Archive
Team Colour Not Working Help :( - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Team Colour Not Working Help :( (/showthread.php?tid=168236)



Team Colour Not Working Help :( - vakhtang - 15.08.2010

Ok Guys I need help in team colours Here is how it looks like
Код:
SetPlayerToTeamColor(playerid)
{
	if (gTeam[playerid] == TEAM_POLICE)
	{
		SetPlayerColor(playerid,0x33CCFFAA);//Light Blue
	}
	else if (gTeam[playerid] == TEAM_EMERGENCY)
	{
		SetPlayerColor(playerid,0x33FF33AA);//Green
	}
	else if (gTeam[playerid] == TEAM_ADMINS)
	{
		SetPlayerColor(playerid,0xFFFFFFAA);//White
	}
	else if (gTeam[playerid] == TEAM_HOMELAND_SECURITY)
	{
		SetPlayerColor(playerid,0x33CCFFAA);
	}
	else if (gTeam[playerid] == TEAM_DESERT_EAGLES)
	{
		SetPlayerColor(playerid,0x33FF33AA);//Green2
	}
	else if (gTeam[playerid] == TEAM_CIVILIAN)
	{
		SetPlayerColor(playerid,0xFFFF00AA);//Yellow
	}
    else if (gTeam[playerid] == TEAM_CRIMINAL)
	{
		SetPlayerColor(playerid,0xFF0000AA);//Red
	}
}
But the color is automatic not what I want What`s the problem?
I thinks there is problem with team thing
Код:
//----------------------------------------------------------------------------//
#define TEAM_POLICE 1
#define TEAM_EMERGENCY 2
#define TEAM_ADMINS 3
#define TEAM_HOMELAND_SECURITY 4
#define TEAM_DESERT_EAGLES 5
#define TEAM_CIVILIAN 6
#define TEAM_CRIMINAL 7
//----------------------------------------------------------------------------//
new gTeam[MAX_PLAYERS];
//----------------------------------------------------------------------------//
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid == 0)
	{
		gTeam[playerid] = TEAM_POLICE;
	}
	else if (classid == 1)
	{
		gTeam[playerid] = TEAM_EMERGENCY;
	}
	else if (classid == 2)
	{
		gTeam[playerid] = TEAM_ADMINS;
	}
	else if (classid == 3)
	{
		gTeam[playerid] = TEAM_HOMELAND_SECURITY;
	}
	else if (classid == 4)
	{
		gTeam[playerid] = TEAM_DESERT_EAGLES;
	}
	else if (classid == 5)
	{
		gTeam[playerid] = TEAM_CIVILIAN;
	}
	else if (classid == 6)
	{
		gTeam[playerid] = TEAM_CRIMINAL;
	}
}
//----------------------------------------------------------------------------//
SetPlayerToTeamColor(playerid)
{
	if (gTeam[playerid] == TEAM_POLICE)
	{
		SetPlayerColor(playerid,0x33CCFFAA);//Light Blue
	}
	else if (gTeam[playerid] == TEAM_EMERGENCY)
	{
		SetPlayerColor(playerid,0x33FF33AA);//Green
	}
	else if (gTeam[playerid] == TEAM_ADMINS)
	{
		SetPlayerColor(playerid,0xFFFFFFAA);//White
	}
	else if (gTeam[playerid] == TEAM_HOMELAND_SECURITY)
	{
		SetPlayerColor(playerid,0x33CCFFAA);
	}
	else if (gTeam[playerid] == TEAM_DESERT_EAGLES)
	{
		SetPlayerColor(playerid,0x33FF33AA);//Green2
	}
	else if (gTeam[playerid] == TEAM_CIVILIAN)
	{
		SetPlayerColor(playerid,0xFFFF00AA);//Yellow
	}
    else if (gTeam[playerid] == TEAM_CRIMINAL)
	{
		SetPlayerColor(playerid,0xFF0000AA);//Red
	}
}
if there is problem plz tell me Is this team right


Re: Team Colour Not Working Help :( - Redgie - 15.08.2010

Do you actually call the function at any point?

Also, you do not need to use else if, as they can only meet one condition of the same variable.


Re: Team Colour Not Working Help :( - vakhtang - 15.08.2010

What should I do to make teams and give them colours? plz write code please


Re: Team Colour Not Working Help :( - Ash. - 15.08.2010

pawn Код:
if(GetPlayerTeam(playerid) == 1)
{
     SetPlayerColor(playerid, COLOUR) //Team 1
}
Repeat for the amount of teams you have...


Re: Team Colour Not Working Help :( - Redgie - 15.08.2010

pawn Код:
OnPlayerSpawn(playerid)
{
    SetPlayerToTeamColor(playerid);
}
But it really depends how you want it to work.


Re: Team Colour Not Working Help :( - vakhtang - 15.08.2010

Thanks guy it worked Thanks yeahhhhh


Re: Team Colour Not Working Help :( - Ash. - 15.08.2010

Anytime