21.06.2016, 23:01
Use OnPlayerStateChange since its way more reliable
From wiki about OnPlayerExitVehicle
EDIT: Forgot the > 3
PHP код:
new OldCar[MAX_PLAYERS];
public OnPlayerStateChange(playerid, newstate, oldstate) {
if(oldstate == PLAYER_STATE_ONFOOT && newstate == PLAYER_STATE_DRIVER) // Player entered a vehicle as a driver
{
if(GetPlayerVehicleID(playerid) <= 3) return true;
OldCar[playerid] = GetPlayerVehicleID(playerid);
}
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT) {
GetVehiclePos(OldCar[playerid],Float:vx,Float:vy,Float:vz);
GetVehicleZAngle(OldCar[playerid],Float:va);
Vehicle[OldCar[playerid]][Positionx] = vx;
Vehicle[OldCar[playerid]][Positiony] = vy;
Vehicle[OldCar[playerid]][Positionz] = vz;
}
return 1;
}
Quote:
Not called if the player falls off a bike or is removed from a vehicle by other means such as using SetPlayerPos. |