Player colour always yellow... - 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: Player colour always yellow... (
/showthread.php?tid=415931)
Player colour always yellow... -
DanLore - 15.02.2013
----
Re: Player colour always yellow... -
Da_Noob - 15.02.2013
The issue is:
First, you check if the wanted level of the player equals to 1 OR is bigger than 1. Right now, when you have wanted level 7, it checks if the first condition is true: it is. So it skips all the other steps, making the player's name yellow.
Re: Player colour always yellow... -
DanLore - 15.02.2013
Quote:
Originally Posted by Da_Noob
The issue is:
First, you check if the wanted level of the player equals to 1 OR is bigger than 1. Right now, when you have wanted level 7, it checks if the first condition is true: it is. So it skips all the other steps, making the player's name yellow.
|
I assumed the else if would be the reason it'd skip, what is the correct way to do this then?
Re: Player colour always yellow... -
Vince - 15.02.2013
Use a switch or - not recommended - remove the else'.
Re: Player colour always yellow... -
SuperViper - 15.02.2013
pawn Код:
if(playerData[playerid][playerWantedLevel] == 0)
{
// White Wanted Level
SetPlayerColor(playerid, 0xFFFFFFFF);
}
else if(playerData[playerid][playerWantedLevel] >= 12)
{
// Red Wanted Level
SetPlayerColor(playerid, 0xFF0000AA); // Red
}
else if(playerData[playerid][playerWantedLevel] >= 6)
{
// Orange Wanted Level
SetPlayerColor(playerid, 0xFF6600AA); // Orange
}
else if (playerData[playerid][playerWantedLevel] >= 1)
{
// Yellow Wanted Level
SetPlayerColor(playerid, 0xFFFF00AA); // Yellow
}
Changing the order will fix it.