PDA

View Full Version : GetPlayerColor problem


FunnyBear
09/03/2015, 07:15 PM
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.

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

Abagail
09/03/2015, 07:19 PM
Make a custom function that will return the updated color of the player. That's the easiest way.

FunnyBear
09/03/2015, 07:38 PM
Make a custom function that will return the updated color of the player. That's the easiest way.

Not working