Advertisement
Youssef_Ehab

[FS]Auto Car Fix

Jul 3rd, 2014
1,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. /*==============================================================================
  2. |Credits|
  3. =========
  4. This Fs Is Scripted By Me On 2:41 AM 3/7/2014
  5. Please Dont Remove Credits and if you want to remove them ask for permission
  6. from me or else dont remove them.
  7. And Thanks Also To the samp team(Developers-Beta Testers) and all who made Sa:mp
  8. come to us.
  9. ================================================================================
  10. |Defines & Includes|
  11. ==============================================================================*/
  12. #define FILTERSCRIPT
  13. #include <a_samp>
  14. #if defined FILTERSCRIPT
  15. #define COLOR_GREEN 0x33AA33AA
  16. #define COLOR_RED 0xAA3333AA
  17. /*==============================================================================
  18. |Forwards & News|
  19. ==============================================================================*/
  20. forward AutoFix();
  21. new AutoRepair[MAX_PLAYERS];
  22. //============================================================================//
  23. public OnFilterScriptInit()
  24. {
  25. SetTimer("AutoFix", 500, 1);
  26. print("\n--------------------------------------");
  27. print(" Auto Car Fix Filterscript By Youssef Ehab Loaded");
  28. print("--------------------------------------\n");
  29. return 1;
  30. }
  31.  
  32. public OnFilterScriptExit()
  33. {
  34. print("\n--------------------------------------");
  35. print(" Auto Car Fix Filterscript By Youssef Ehab Unloaded");
  36. print("--------------------------------------\n");
  37. return 1;
  38. }
  39.  
  40. #else
  41.  
  42. main()
  43. {
  44. }
  45.  
  46. #endif
  47.  
  48. public OnPlayerConnect(playerid)
  49. {
  50. AutoRepair[playerid] = false;
  51. return 1;
  52. }
  53.  
  54. public OnPlayerCommandText(playerid, cmdtext[])
  55. {
  56. if (strcmp("/autofix", cmdtext, true, 20) == 0)
  57. {
  58. if(AutoRepair[playerid])
  59. {
  60. AutoRepair[playerid] = false;
  61. SendClientMessage(playerid, COLOR_RED, "You Have Turned Off Your Car's Auto Repair!");
  62. }
  63. else
  64. {
  65. AutoRepair[playerid] = true;
  66. SendClientMessage(playerid, COLOR_GREEN, "You Have Turned On Your Car's Auto Repair!");
  67. }
  68. return 1;
  69. }
  70. return 1;
  71. }
  72.  
  73. public AutoFix()
  74. {
  75. for(new playerid=0; playerid<MAX_PLAYERS; playerid++)
  76. {
  77. if(IsPlayerConnected(playerid))
  78. {
  79. if(!AutoRepair[playerid]) return 0;
  80. new Float:health, vehicleid;
  81. if (IsPlayerInAnyVehicle(playerid))
  82. {
  83. vehicleid = GetPlayerVehicleID(playerid);
  84. GetVehicleHealth(vehicleid, health);
  85. if (health < 999)
  86. {
  87. RepairVehicle(GetPlayerVehicleID(playerid));
  88.  
  89. }
  90. }
  91. }
  92. }
  93. return 1;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement