21.07.2013, 13:44
pawn Код:
new lastvehicle[MAX_PLAYERS]; //Under your #includes etc. at the top of your script
public OnPlayerStateChange(playerid, newstate, oldstate)
{
//if(newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER) // Use this is you want for passenger + driver seats.
if(newstate == PLAYER_STATE_DRIVER) //If the player enters the car as a driver.
{
lastvehicle[playerid] = GetPlayerVehicleID(playerid);
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
lastvehicle[playerid] = INVALID_VEHICLE_ID;
return 1;
}
public OnPlayerConnect(playerid)
{
lastvehicle[playerid] = INVALID_VEHICLE_ID;
return 1;
}
CMD:mycommand(playerid, params[]) //Example command: /mycommand
{
if(lastvehicle[playerid] == INVALID_VEHICLE_ID) return SendClientMessage(playerid, -1, "You have not entered a vehicle yet.");
if(PlayerIsNotCloseTo(lastvehicle[playerid])
{
SendClientMessage(playerid, -1, "You aren't even near the damn thing...");
}
else
{
SendClientMessage(playerid, -1, "You found your car.");
}
return 1;
}