OnPlayerStateChange won't work
#1

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
	{
        case 601, 598, 427, 523, 497, 421:
        {
			if(GetTeam{playerid} == CLASS_CIV && newstate == PLAYER_STATE_DRIVER)
			{
			    if(GetPlayerLastVehicleID[playerid] != GetPlayerVehicleID(playerid))
			    {
	                new current_zone;
	        		current_zone = Player_Zone[playerid];
					new string[150];
		            format(string,sizeof(string),"[DISPATCH]: Suspect %s [%d] has just stolen a law enforcement vehicle at %s", GetName(playerid), playerid, ZoneNames[current_zone][zone_name]);
	                CopRadio(BLUE, string);
	                SetPlayerWantedLevel(playerid,GetPlayerWantedLevel(playerid) + 4);
	                SendClientMessage(playerid, RED, "Law enforcement vehicle theft [WANTED LEVEL INCREASED]");
	        		return 1;
        		}
			}
        }
}
This piece of code won't work. As a CLASS_CIV player enter a vehicle with those types (601, 598, 427, 523, 497, 421) he won't get SetPlayerWantedLevel(playerid,GetPlayerWantedLevel (playerid) + 4);

Any thoughts? Help will be rewarded with rep.
Reply
#2

On that "case" line, are there supposed to be the vehicle's IDs or Type?

Still, any help would be awesome.
Reply
#3

Print your code line by line
I mean like this:

Line 1 bla bla bla
print("#1");
Next Line bla. Bla bla
print("#2");

And see in consol that which line stops your code (debuging > search in wiki )
If you couldn't fix, post here and tell me which line stops your code…
For example if in consol you see:
#1
#2
#3

This mean after print("#3"); your code stops and copy line after print("#3);

But i think your problem is GetPlayerLastVehicleID
I'm not sure but i think..
I'm on my cellphone and i can't test the code. Debug it by yourself and poat here result
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)