stock SetPlayerColors(playerid, level)
{
if(GetPlayerWantedLevel(playerid) >= 0)
{
SetPlayerColor(playerid, COLOR_WHITE);
}
else if(GetPlayerWantedLevel(playerid) >= 1 && GetPlayerWantedLevel(playerid) <= 3)
{
SetPlayerColor(playerid, COLOR_YELLOW);
}
else if(GetPlayerWantedLevel(playerid) >= 4 && GetPlayerWantedLevel(playerid) <= 10)
{
SetPlayerColor(playerid, COLOR_ORANGE);
}
else if(GetPlayerWantedLevel(playerid) >= 11 && GetPlayerWantedLevel(playerid) <= 50)
{
SetPlayerColor(playerid, COLOR_DARKORANGE);
}
return 1;
}
switch(GetPlayerWantedLevel(playerid))
{
case 0: SetPlayerColor(playerid, COLOR_WHITE);
case 1 .. 3: SetPlayerColor(playerid, COLOR_YELLOW);
case 4 .. 10: SetPlayerColor(playerid, COLOR_ORANGE)
default: SetPlayerColor(playerid, COLOR_DARKORANGE);
}
You mean "function". There's no such thing as "a stock". It's not random, it's just flawed logic. Unless you have negative levels the color will always be white. Consider using a switch.
PHP код:
|
stock SetPlayerColors(playerid, level)
{
switch(GetPlayerWantedLevel(playerid))
{
case 0: SetPlayerColor(playerid, COLOR_WHITE);
case 1 .. 3: SetPlayerColor(playerid, COLOR_YELLOW);
case 4 .. 10: SetPlayerColor(playerid, COLOR_ORANGE)
default: SetPlayerColor(playerid, COLOR_DARKORANGE);
}
return 1;
}
Hello vince, i make it like this
and still not work... PHP код:
|
SetPlayerColors(playerid, level) { switch(GetPlayerWantedLevel(playerid)) { case 0: SetPlayerColor(playerid, COLOR_WHITE); case 1 .. 3: SetPlayerColor(playerid, COLOR_YELLOW); case 4 .. 10: SetPlayerColor(playerid, COLOR_ORANGE) default: SetPlayerColor(playerid, COLOR_DARKORANGE); } return 1; }
warning 203: symbol is never used: "SetPlayerColors"
its should be like this?
Код:
SetPlayerColors(playerid, level) { switch(GetPlayerWantedLevel(playerid)) { case 0: SetPlayerColor(playerid, COLOR_WHITE); case 1 .. 3: SetPlayerColor(playerid, COLOR_YELLOW); case 4 .. 10: SetPlayerColor(playerid, COLOR_ORANGE) default: SetPlayerColor(playerid, COLOR_DARKORANGE); } return 1; } |