Advertisement
Vikshay

Auto Car Repair [Full Repair]

Jul 12th, 2013
1,520
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.17 KB | None | 0 0
  1. //Edited by Vikshay
  2.  
  3. #include <a_samp>
  4.  
  5. #define COLOR_YELLOW 0xFFFF00AA
  6.  
  7. forward FixAllCar();
  8. new FixTimer;
  9.  
  10. public OnFilterScriptInit()
  11. {
  12.     print("\n--------------------------------------");
  13.     print(" Auto Car Repair By : Brian Gutierrez ");
  14.     print("--------------------------------------\n");
  15.     FixTimer = SetTimer("FixAllCar",1000,true);//every 1000 milisecond we call the function "FixAllCar"
  16.     return 1;
  17. }
  18.  
  19. public OnFilterScriptExit()
  20. {
  21.     KillTimer(FixTimer); // we kill our timer on script unload.
  22.     return 1;
  23. }
  24.  
  25. public FixAllCar()
  26. {
  27.     for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
  28.     // loop all possible player
  29.     {
  30.         if(IsPlayerConnected(playerid) && IsPlayerInAnyVehicle(playerid))
  31.         //if the player is connected AND in a car
  32.         {
  33.             new vehicleid = GetPlayerVehicleID(playerid);// gettin the vehicle id
  34.             SetVehicleHealth(vehicleid,1000.0);// set the vehicle health
  35.         }
  36.     }
  37. }
  38.  
  39. public OnVehicleDamageStatusUpdate(vehicleid, playerid)
  40. {
  41.     #pragma unused playerid
  42.  
  43.     new panels, doors, lights, tires;
  44.     GetVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  45.     tires = encode_tires(0, 0, 0, 0); // fix all tires
  46.     panels = encode_panels(0, 0, 0, 0, 0, 0, 0); // fix all panels //fell off - (3, 3, 3, 3, 3, 3, 3)
  47.     doors = encode_doors(0, 0, 0, 0, 0, 0); // fix all doors //fell off - (4, 4, 4, 4, 0, 0)
  48.     lights = encode_lights(0, 0, 0, 0); // fix all lights
  49.     UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, tires);
  50.     return 1;
  51. }
  52.  
  53. encode_tires(tire1, tire2, tire3, tire4) return tire1 | (tire2 << 1) | (tire3 << 2) | (tire4 << 3);
  54. encode_panels(flp, frp, rlp, rrp, windshield, front_bumper, rear_bumper)
  55. {
  56.     return flp | (frp << 4) | (rlp << 8) | (rrp << 12) | (windshield << 16) | (front_bumper << 20) | (rear_bumper << 24);
  57. }
  58. encode_doors(bonnet, boot, driver_door, passenger_door, behind_driver_door, behind_passenger_door)
  59. {
  60.     #pragma unused behind_driver_door
  61.     #pragma unused behind_passenger_door
  62.     return bonnet | (boot << 8) | (driver_door << 16) | (passenger_door << 24);
  63. }
  64. encode_lights(light1, light2, light3, light4)
  65. {
  66.     return light1 | (light2 << 1) | (light3 << 2) | (light4 << 3);
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement