Guest User

adrian

a guest
Jan 8th, 2018
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.60 KB | None | 0 0
  1. stock AutoOcupado(vid)
  2. {
  3.      for(new i, j = GetPlayerPoolSize(); i <= j; i++)
  4.      {
  5.           if(!IsPlayerConnected(i)) continue;
  6.           if(GetPlayerVehicleID(i) == vid && GetPlayerVehicleSeat(i) == 0) return 1;
  7.      }
  8.      return 0;
  9. }
  10.  
  11. public OnUnoccupiedVehicleUpdate(vehicleid, playerid, passenger_seat, Float:new_x, Float:new_y, Float:new_z, Float:vel_x, Float:vel_y, Float:vel_z)
  12. {
  13.     if(AutoOcupado(vehicleid) == 1) return 1;
  14.  
  15.     new Float:vehx, Float:vehy, Float:vehz;
  16.     GetVehiclePos(vehicleid, vehx, vehy, vehz);
  17.  
  18.     if(GetVehicleDistanceFromPoint(vehicleid, new_x, new_y, new_z) > 10)
  19.     {
  20.         SetVehiclePos(vehicleid, vehx, vehy, vehz);
  21.         SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
  22.         return 0;
  23.     }
  24.  
  25.     new Float:PlayerSpeedDistance;
  26.     PlayerSpeedDistance = floatmul(floatsqroot(floatadd(floatadd(floatpower(vel_x, 2), floatpower(vel_y, 2)), floatpower(vel_z, 2))), 170.0);
  27.     new spe = floatround(PlayerSpeedDistance * 1);
  28.  
  29.     if(spe > 5 && passenger_seat > 0)
  30.     {
  31.         SetVehiclePos(vehicleid, vehx, vehy, vehz);
  32.         SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
  33.         return 0;
  34.     }
  35.     if(passenger_seat == 0)
  36.     {
  37.         if(spe > 25)
  38.         {
  39.             SetVehiclePos(vehicleid, vehx, vehy, vehz);
  40.             SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
  41.             return 0;
  42.         }
  43.  
  44.         new Float: fDistance = GetPlayerDistanceFromPoint(playerid, vehx, vehy, vehz);
  45.  
  46.         if(fDistance > 7 && spe > 5)
  47.         {
  48.             SetVehiclePos(vehicleid, vehx, vehy, vehz);
  49.             SetVehicleVelocity(vehicleid, 0.0, 0.0, 0.0);
  50.             return 0;
  51.         }
  52.     }
  53.     return 1;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment