Need Help - SetPlayerColourFromTeam
#1

I have defined the colours:
Код:
#define TEAM_GROVE_COLOR 0x00FF00AA
#define TEAM_BALLA_COLOR 0xFF00FFAA
I have set the teams on id check:
Код:
SetPlayerTeamFromClass(playerid, classid)
{
	if (classid >= 105)
	{
		SetPlayerTeam(playerid,GROVE);
	}
	else
	{
		SetPlayerTeam(playerid,BALLAS);
	}
}
Here is the colour command:
Код:
SetPlayerToTeamColor(playerid)
{
	if (GetPlayerTeam(playerid) == GROVE)
	{
		SetPlayerColor(playerid, TEAM_GROVE_COLOR);
	}
	else if (GetPlayerTeam(playerid) == BALLAS)
	{
		SetPlayerColor(playerid, TEAM_BALLA_COLOR);
	}
}
I don't get any errors but the colour system doesn't work. I always end up the same colour, even on different teams... What's wrong with the script? Please help!
Reply
#2

I've noticed there were a few bugs with the SetPlayerTeam function. Instead, I've used variables to define the different teams.
Reply
#3

I was using a variable, but then I didn't want to make an anti-teamkill system (because I don't know how to) so I switched to SetPlayerTeam... I really hope I don't have to switch back again.
Reply
#4

Quote:
Originally Posted by Tigerbeast11
Посмотреть сообщение
I was using a variable, but then I didn't want to make an anti-teamkill system (because I don't know how to) so I switched to SetPlayerTeam... I really hope I don't have to switch back again.
SetPlayerTeam is still buggy. I've noticed you can still be killed by one of your team-mates.
Reply
#5

I guess I'll have to change back...
Do you know how to make an anti-teamkill system?
Reply
#6

Just because the function is buggy, doesn't mean it's ineffective

Example:

PHP код:
new playerteam[MAX_PLAYERS];
if(
playerteam[playerid] == 1)
{
    
SetPlayerTeam(playerid1)
}
else if(
playerteam[playerid] == 2)
{
    
SetPlayerTeam(playerid2)

To assure that there are no bugs, when calling anything to check which team the player is one, use the variable.

PHP код:
CMD:hi(playeridparams[])
{
    if(
playerteam[playerid] == 1)
    {
        
//code
    
}

Instead of:

PHP код:
CMD:hi(playeridparams[])
{
    if(
GetPlayerTeam(playerid) == 1)
    {
        
//code
    
}

This is an example in relation to command which will allow both some-what of immunity to team-mates plus there shouldn't really be any bugs when using a variable.
Reply
#7

OK, thanks, I'll try that!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)