Advertisement
Guest User

Example Anti-Teleport Vehicle by AirKite (edit Stepashka)

a guest
Jul 27th, 2011
459
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.45 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Float:vehiclePos[MAX_VEHICLES][4];
  4.  
  5. public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat)
  6. {
  7.     if ( floatcmp(vehiclePos[vehicleid][0], 0.0) && floatcmp(vehiclePos[vehicleid][1], 0.0) && floatcmp(vehiclePos[vehicleid][2], 0.0))
  8.     {
  9.         if ( floatcmp( GetVehicleDistanceFromPoint(vehicleid, vehiclePos[vehicleid][0], vehiclePos[vehicleid][1], vehiclePos[vehicleid][2]), 15.0) == 1)
  10.         {
  11.             SetVehiclePos(vehicleid, vehiclePos[vehicleid][0], vehiclePos[vehicleid][1], vehiclePos[vehicleid][2]);
  12.             SetVehicleZAngle(vehicleid, vehiclePos[vehicleid][3]);
  13.             return;
  14.         }
  15.     }
  16.     GetVehiclePos(vehicleid, vehiclePos[vehicleid][0], vehiclePos[vehicleid][1], vehiclePos[vehicleid][2]);
  17.     GetVehicleZAngle(vehicleid, vehiclePos[vehicleid][3]);
  18. }
  19.  
  20. public OnPlayerStateChange(playerid, newstate, oldstate)
  21. {
  22.     static lastCar[MAX_PLAYERS] = {INVALID_VEHICLE_ID,...};
  23.     if ( lastCar[playerid] == INVALID_VEHICLE_ID && (newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER))
  24.     {
  25.         lastCar[playerid] = GetPlayerVehicleID(playerid);
  26.     }
  27.     if ( lastCar[playerid] != INVALID_VEHICLE_ID && (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER))
  28.     {
  29.         GetVehiclePos(lastCar[playerid],vehiclePos[lastCar[playerid]][0], vehiclePos[lastCar[playerid]][1], vehiclePos[lastCar[playerid]][2]);
  30.         GetVehicleZAngle(lastCar[playerid], vehiclePos[lastCar[playerid]][3]);
  31.         lastCar[playerid] = INVALID_VEHICLE_ID;
  32.     }
  33.     return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement