Advertisement
Guest User

Auto Destroyer

a guest
Apr 2nd, 2015
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. // Auto Destroyer
  2. //
  3. // By Golf
  4.  
  5. #include <a_samp>
  6. #include <mapandreas>
  7. #include <zcmd>
  8.  
  9. #define infinity (Float:0x7FFFFFFF)
  10.  
  11. new
  12. bool:activatE[MAX_PLAYERS] = false,
  13. timersE[MAX_PLAYERS]
  14. ;
  15.  
  16. main()
  17. {
  18. print("\n----------------------------------");
  19. print(" Auto Destroy by GOlf R2015");
  20. print("----------------------------------\n");
  21. }
  22.  
  23. public OnFilterScriptInit()
  24. {
  25. print("\n-----------Auto Destroy by GOlf----------------"),MapAndreas_Init(MAP_ANDREAS_MODE_FULL);
  26. print("--------------------------------------\n");
  27. return 1;
  28. }
  29.  
  30. public OnFilterScriptExit()
  31. {
  32. return 1;
  33. }
  34.  
  35.  
  36.  
  37.  
  38. CMD:activate(playerid, params[]) {
  39.  
  40. if(IsPlayerInAnyCombat(playerid) == 0) return SendClientMessage(playerid,-1,"Error ");
  41. activatE[playerid] = true;
  42. SendClientMessage(playerid,-1,"Auto Destroyer activated ");
  43. timersE[playerid] = SetTimerEx("UpdateE", 1000, true, "i", playerid);
  44. return 1;
  45. }
  46.  
  47. CMD:disactivate(playerid, params[]) {
  48.  
  49. if(IsPlayerInAnyCombat(playerid) == 0) return SendClientMessage(playerid,-1,"erreur 404 ");
  50. activatE[playerid] = false;
  51. SendClientMessage(playerid,-1,"Auto Destroyer disactivated ");
  52. KillTimer(timersE[playerid]);
  53. return 1;
  54. }
  55.  
  56. CMD:spawn(playerid, params[]) {
  57.  
  58. new Float:F[3];
  59. GetPlayerPos(playerid, F[0], F[1], F[2]);
  60. CreateVehicle(520, F[0], F[1], F[2], 82.2873, 0, 1, 60);
  61. return 1;
  62. }
  63.  
  64. public OnPlayerExitVehicle(playerid, vehicleid)
  65. {
  66. if(activatE[playerid] == true)
  67. {
  68. activatE[playerid] = false;
  69. SendClientMessage(playerid,-1,"Auto Destroyer disactivated ");
  70. KillTimer(timersE[playerid]);
  71. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  72. }
  73. return 1;
  74. }
  75.  
  76. public OnPlayerDeath(playerid, killerid, reason)
  77. {
  78. if(activatE[playerid] == true)
  79. {
  80. activatE[playerid] = false;
  81. SendClientMessage(playerid,-1,"Auto Destroyer disactivated ");
  82. KillTimer(timersE[playerid]);
  83. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  84. }
  85. return 1;
  86. }
  87.  
  88. forward IsPlayerInAnyCombat(playerid); public IsPlayerInAnyCombat(playerid) {
  89.  
  90. new v = GetVehicleModel(GetPlayerVehicleID(playerid));
  91. if(v == 476 || v == 520 || v == 548 || v == 425) { return 1; } // hydra // hunter, and two helic
  92. return 0;
  93. }
  94.  
  95. forward UpdateE(playerid); public UpdateE(playerid) {
  96.  
  97. if(activatE[playerid] == false) return 1;
  98. new Float:F[4];
  99. SetVehicleHealth(GetPlayerVehicleID(playerid), infinity);
  100. GetPlayerPos(playerid, F[0], F[1], F[2]);
  101. MapAndreas_FindZ_For2DCoord(F[0], F[1], F[3]);
  102. CreateExplosion(F[0], F[1], F[3], 11, 12.0);
  103. for(new Ps = 0 ; Ps < MAX_PLAYERS ; Ps ++ ) {
  104. if(IsPlayerInRangeOfPoint(Ps, 3.0, F[0], F[1], F[3])) return SetPlayerHealth(Ps,0.0);
  105. }
  106. return true;
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement