Posts: 108
Threads: 21
Joined: Aug 2016
Код:
forward WantedLevelColour(playerid);
public WantedLevelColour(playerid)
{
switch(GetPlayerWantedLevel(playerid))
{
case 0: SetPlayerColor(playerid, COLOR_WHITE);
case 1: SetPlayerColor(playerid, COLOR_PURPLE);
default: SetPlayerColor(playerid, COLOR_RED);
}
return 1;
}
Could somebody tell me why this isn't working?
i've it all ways and it still doesn't work.
Posts: 3,324
Threads: 96
Joined: Sep 2013
Quote:
Originally Posted by MCZOFT
3 words for you
Learn Algorithms First.
Then talk to me .
surely it's copied example i didn't say i wrote it . so instead of trying to be a hero , solve his problem with the information given or Quit the forum "breow"
|
Dude, just leave the fucking Scripting Help section. You aren't helping anyone. In fact, you've lied to this guy.
@CannonBolt: Ignore everything MCZOFT said. Your code is correct, as GoldenLion said. Just answer GoldenLion's question.
Posts: 108
Threads: 21
Joined: Aug 2016
Thanks @Crayder.
1. Should i change it to a stock?
2. i place it onplayerspawn as "WantedLevelColour(playerid);"
even when i get stars my color doesn't seem to change.
Posts: 482
Threads: 3
Joined: Dec 2009
Reputation:
0
May I ask where you are calling this function?
Are you calling it under OnPlayerUpdate ? Or when they do a specific action?
Posts: 108
Threads: 21
Joined: Aug 2016
Quote:
Originally Posted by azzerking
May I ask where you are calling this function?
Are you calling it under OnPlayerUpdate ? Or when they do a specific action?
|
Quote:
Originally Posted by CannonBolt
2. i place it onplayerspawn as "WantedLevelColour(playerid);"
even when i get stars my color doesn't seem to change.
|
Putting this under OnPlayerUpdate is a bad idea.
Posts: 3,324
Threads: 96
Joined: Sep 2013
Quote:
Originally Posted by CannonBolt
Thanks @Crayder.
1. Should i change it to a stock?
2. i place it onplayerspawn as "WantedLevelColour(playerid);"
even when i get stars my color doesn't seem to change.
|
There is your problem. If you are only calling it when the player spawns it will not change when the wanted level of that player changes.
You should hook SetPlayerWantedLevel and add this line to it. That will be the only time you ever need to call it! Do not call it anywhere else!