SA-MP Forums Archive
team colour problem - 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)
+--- Thread: team colour problem (/showthread.php?tid=334803)



team colour problem - oscar7610 - 15.04.2012

#define ITALIAN_MAFIA 0
#define RUSSIAN_MAFIA 1
/////////////////////////////////////////////
#define ITALIAN_MAFIA_COLOR 0xFA0505 //Red//
#define RUSSIAN_MAFIA_COLOR 0x59BA56 //Green//


When I select class and talk example I select russian i talk green. Then I f4 to change to italian mafia and it keeps green. sometimes it goes red sometimes green.

forward SetPlayerToTeamColor(playerid);
public SetPlayerToTeamColor(playerid)
{
if(gTeam[playerid] == ITALIAN_MAFIA)
{
SetPlayerColor(playerid,ITALIAN_MAFIA_COLOR);
}
else if(gTeam[playerid] == RUSSIAN_MAFIA)
{
SetPlayerColor(playerid, RUSSIAN_MAFIA_COLOR);
}
return 1;
}

they are perfect I cant find the problem.


Re: team colour problem - oscar7610 - 15.04.2012

+rep help


Re: team colour problem - @Riichard - 15.04.2012

Put OnPlayerDeath to name a color, and when he spawns put the color of each team ..
Ex:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerColor(playerid,0xFFFFFFAA); // Color White.
return 1;
}
And
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == RUSSIAN_MAFIA)
{
SetPlayerColor(playerid, RUSSIAN_MAFIA_COLOR);
}
if(gTeam[playerid] == ITALIAN_MAFIA)
{
SetPlayerColor(playerid,ITALIAN_MAFIA_COLOR);
}
return 1;
}
Not tested, I have helped


Re: team colour problem - oscar7610 - 16.04.2012

Quote:
Originally Posted by @Riichard
Посмотреть сообщение
Put OnPlayerDeath to name a color, and when he spawns put the color of each team ..
Ex:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
SetPlayerColor(playerid,0xFFFFFFAA); // Color White.
return 1;
}
And
pawn Код:
public OnPlayerSpawn(playerid)
{
if(gTeam[playerid] == RUSSIAN_MAFIA)
{
SetPlayerColor(playerid, RUSSIAN_MAFIA_COLOR);
}
if(gTeam[playerid] == ITALIAN_MAFIA)
{
SetPlayerColor(playerid,ITALIAN_MAFIA_COLOR);
}
return 1;
}
Not tested, I have helped

+rep thanks


Re: team colour problem - @Riichard - 16.04.2012

Quote:
Originally Posted by oscar7610
Посмотреть сообщение
+rep thanks
I am here to help


Re: team colour problem - sniperwars - 16.04.2012

This problem was already solved as he added me on Skype and I helped him with this.

I used SetPlayerToTeamColor on the OnPlayerSpawn callback.. It works now anyway. Thanks
for helping