SA-MP Forums Archive
Oldcar and newcar ID - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Oldcar and newcar ID (/showthread.php?tid=558766)



Oldcar and newcar ID - Markus1337 - 18.01.2015

I got this so far:
pawn Код:
new lastvehicle[MAX_PLAYERS];

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER)
    {
        lastvehicle[playerid] = GetPlayerVehicleID(playerid);
    }
    return 1;
}
Now my problem, I don't know how to check if new vehicleid matches the old one on OnPlayerStateChange, any ideas?
Basically I want to terminate a mission etc if vehicle ids arent matching.


Re: Oldcar and newcar ID - Schneider - 18.01.2015

pawn Код:
if(lastvehicle[playerid] != GetPlayerVehicleID(playerid))
{
    //terminate
}



Re: Oldcar and newcar ID - Markus1337 - 18.01.2015

Ah thanks, didnt think of using != :P