public OnPlayerExitVehicle(playerid, vehicleid) { if(GetPlayerVehicleID(playerid) > 3) { GetVehiclePos(vehicleid,Float:vx,Float:vy,Float:vz); GetVehicleZAngle(vehicleid,Float:va); for(new i = 0; i < sizeof(Vehicle); i++) { Vehicle[i][Positionx] = vx; Vehicle[i][Positiony] = vy; Vehicle[i][Positionz] = vz; SaveThings(); } } return 1; }
public OnPlayerExitVehicle(playerid, vehicleid)
{
if(vehicleid > 3)
{
GetVehiclePos(vehicleid,Float:vx,Float:vy,Float:vz);
GetVehicleZAngle(vehicleid,Float:va);
Vehicle[vehicleid][Positionx] = vx;
Vehicle[vehicleid][Positiony] = vy;
Vehicle[vehicleid][Positionz] = vz;
SaveThings();
}
return 1;
}
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;
}
Not called if the player falls off a bike or is removed from a vehicle by other means such as using SetPlayerPos. |
You didn't understand me... I mean, all cars respawn in the last position where I exited a vehicle from when I restart the server.
|