Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new Float:vehiclePos[MAX_VEHICLES][4];
- public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)
- {
- if ( floatcmp(vehiclePos[vehicleid][0], 0.0) && floatcmp(vehiclePos[vehicleid][1], 0.0) && floatcmp(vehiclePos[vehicleid][2], 0.0))
- {
- if ( floatcmp( GetVehicleDistanceFromPoint(vehicleid, vehiclePos[vehicleid][0], vehiclePos[vehicleid][1], vehiclePos[vehicleid][2]), 15.0) == 1)
- {
- SetVehiclePos(vehicleid, vehiclePos[vehicleid][0], vehiclePos[vehicleid][1], vehiclePos[vehicleid][2]);
- SetVehicleZAngle(vehicleid, vehiclePos[vehicleid][3]);
- return;
- }
- }
- GetVehiclePos(vehicleid, vehiclePos[vehicleid][0], vehiclePos[vehicleid][1], vehiclePos[vehicleid][2]);
- GetVehicleZAngle(vehicleid, vehiclePos[vehicleid][3]);
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- static lastCar[MAX_PLAYERS] = {INVALID_VEHICLE_ID,...};
- if ( lastCar[playerid] == INVALID_VEHICLE_ID && (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER))
- {
- lastCar[playerid] = GetPlayerVehicleID(playerid);
- }
- if ( lastCar[playerid] != INVALID_VEHICLE_ID && (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER))
- {
- GetVehiclePos(lastCar[playerid],vehiclePos[lastCar[playerid]][0], vehiclePos[lastCar[playerid]][1], vehiclePos[lastCar[playerid]][2]);
- GetVehicleZAngle(lastCar[playerid], vehiclePos[lastCar[playerid]][3]);
- lastCar[playerid] = INVALID_VEHICLE_ID;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement