GetPlayerColor problem
#1

Hey, I have a problem with GetPlayerColor. I made a function, where if someone who is not a cop, who enters a cop vehicle, they will get wanted. A message will be sent to them saying their wanted level, and why their wanted level was risen. The color of the message would be the same color as the player, using GetPlayerColor.

The problem is, after their wanted level has been set, the message will be sent in the color before they were wanted. So, its one wanted level behind.

pawn Код:
for(new i = 0; i < sizeof(PoliceVehicles); i ++)
        {
            if(vehicleid == PoliceVehicles[i] && !IsALawEnforcement(playerid))
            {
                iWantedL[playerid]++;
                new str[128];
                SetPlayerWantedLevel(playerid, GetPlayerWantedLevel(playerid) + 1);
                format(str, sizeof(str), "[WANTED LEVEL] Wanted level %d - Stealing a Law Enforcement vehicle", iWantedL[playerid]);
                SendClientMessage(playerid, GetPlayerColor(playerid), str);
            }
        }
It should work, as I have a timer which automatically sets people colors according to their teams/wanted levels. And if I type in the chat, the correct player color would come up.

e.g.

-Player enters vehicle
-Wanted level rises and player receives a message in their color
-Color of the message is their previous color, although their color has already been changed

How am I able to fix this?

Thanks
Reply
#2

Make a custom function that will return the updated color of the player. That's the easiest way.
Reply
#3

Quote:
Originally Posted by Abagail
Посмотреть сообщение
Make a custom function that will return the updated color of the player. That's the easiest way.
Not working
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)