SA-MP Forums Archive
Get the vehicle ID the player was last in? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Get the vehicle ID the player was last in? (/showthread.php?tid=192479)



Get the vehicle ID the player was last in? - TheHoodRat - 22.11.2010

Hi,
I'm creating a trunk script for my gamemode, and I'm a bit confused.
I want to know how I can get the vehicle ID the player was last in.

For example, if the player drove a Mesa (ID 32) recently and is now on foot how can I detect that?

GetPlayerVehicleID only detects IF the player is in the vehicle.

Thanks.


Re: Get the vehicle ID the player was last in? - BMUK - 22.11.2010

new P_LastVeh[MAX_PLAYERS];

Could use that when a player sit's in a vehicle to store it.

P_LastVeh[playerid] = GetPlayerVehicleID(playerid);


Re: Get the vehicle ID the player was last in? - Kwarde - 22.11.2010

pawn Код:
//Above your script:
new LastPlayerInVec[MAX_VEHICLES] = (-1);

//Callback OnPlayerExitVehicle:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(GetPlayerState(playerid) == 2) // Is he/she the driver?
        LastPlayerInVec[vehicleid] = playerid;
    return 1;
}

//The function
stock GetLastPlayerInVehicle(vehicleid)
{
    if(LastPlayerInVec[vehicleid] != -1) //Did someone entered it?
        return LastPlayerInVec[vehicleid];
    return 0;
}
Try this ^^

[EDIT]
Damn bmuk was faster


Re: Get the vehicle ID the player was last in? - TheHoodRat - 22.11.2010

Thanks guys, helped a lot.