ID of last vehicle entered -
SnG.Scot_MisCuDI - 25.07.2012
How can i get the vehicle id of the last vehicle the player was in?
Example: I get into an elegy ID: 20, then i exit, and do /lock, then it locks car ID:20
Re: ID of last vehicle entered -
Akira297 - 25.07.2012
For yourself or for a player like,
/lastvehicle [ID] [CarID]?
Re: ID of last vehicle entered -
SnG.Scot_MisCuDI - 25.07.2012
Well its not a command to see the last id, its used so the player, once he leaves the car, he can use /lock and it locks that car. "that car" is the ID of the last car he was in
Re: ID of last vehicle entered -
Akira297 - 25.07.2012
Oh? So like a string sent to the player of his vehicle ID?
I'm honestly not understanding your question/request.
Re: ID of last vehicle entered -
SnG.Scot_MisCuDI - 25.07.2012
Okay, so, a player enters vehicle ID: 20, (not the actual model id but the unique id it is given when spawned). So now he has "ownership" of vehicle ID: 20. When he exits the car, and does: /lock, it locks ONLY vehicle ID: 20. And another player tries to enter it, and it says "blah blah car is locked"
Re: ID of last vehicle entered -
DeathTone - 25.07.2012
Quote:
Originally Posted by SnG.Scot_MisCuDI
How can i get the vehicle id of the last vehicle the player was in?
Example: I get into an elegy ID: 20, then i exit, and do /lock, then it locks car ID:20
|
Make a global variable:
new LastVehicle[MAX_PLAYERS];
OnPlayerStateChange, when he actually enters a vehicle, do:
LastVehicle[playerid] = GetVehicleID(playerid);
Then it will just set that variable to every vehicle he enters, and it won't change until he enters a new vehicle. So to view the last vehicle a player entered, use LastVehicle[playerid]
Re: ID of last vehicle entered -
SnG.Scot_MisCuDI - 25.07.2012
Okay, so how would i check to see if another player (not ownership of that ID) enters it while its locked and he gets ejected?
Re: ID of last vehicle entered -
maramizo - 25.07.2012
My guess would be you have the array PlayerInfo assigned to MAX_PLAYERS with enumerator of pKeys.
So it would go.
pawn Код:
OnPlayerExitVehicle //bla bla
Lastcar[playerid] = vehicleid //bla blah
CMD:lock(playerid, params[])
{
if(lastcar[playerid] != PlayerInfo[playerid][pKeys]) return SendClientMessage(playerid, COLOR_WHITE, "You do not own that vehicle.");
else
{
//lock
}
return 1;
}