Need Help - SetPlayerColourFromTeam -
Tigerbeast11 - 08.08.2011
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!
Re: Need Help - SetPlayerColourFromTeam -
Kush - 08.08.2011
I've noticed there were a few bugs with the SetPlayerTeam function. Instead, I've used variables to define the different teams.
Re: Need Help - SetPlayerColourFromTeam -
Tigerbeast11 - 08.08.2011
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.
Re: Need Help - SetPlayerColourFromTeam -
Kush - 08.08.2011
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.
Re: Need Help - SetPlayerColourFromTeam -
Tigerbeast11 - 08.08.2011
I guess I'll have to change back...
![Sad](images/smilies/sad.gif)
Do you know how to make an anti-teamkill system?
Re: Need Help - SetPlayerColourFromTeam -
Kush - 08.08.2011
Just because the function is buggy, doesn't mean it's ineffective
Example:
PHP код:
new playerteam[MAX_PLAYERS];
if(playerteam[playerid] == 1)
{
SetPlayerTeam(playerid, 1)
}
else if(playerteam[playerid] == 2)
{
SetPlayerTeam(playerid, 2)
}
To assure that there are no bugs, when calling anything to check which team the player is one, use the variable.
PHP код:
CMD:hi(playerid, params[])
{
if(playerteam[playerid] == 1)
{
//code
}
}
Instead of:
PHP код:
CMD:hi(playerid, params[])
{
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.
Re: Need Help - SetPlayerColourFromTeam -
Tigerbeast11 - 08.08.2011
OK, thanks, I'll try that!