Advertisement
Guest User

Vehicle Damage by Markonisha

a guest
Jul 6th, 2014
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.88 KB | None | 0 0
  1. /***********************************************
  2. * *
  3. * SA:MP Include or FilterScript *
  4. * "Empty Vehicle Damage" *
  5. * *
  6. * ©Copyright and Script by: Markonisha *
  7. * *
  8. **********************************************/
  9. #include <a_samp>
  10.  
  11. new HealthUnderZero[MAX_VEHICLES];
  12. new EB[MAX_VEHICLES];
  13.  
  14. public OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ )
  15. {
  16. new Float:health, Float:X, Float:Y, Float:Z;
  17. switch( hittype )
  18. {
  19. case BULLET_HIT_TYPE_VEHICLE:
  20. {
  21. GetVehicleHealth(hitid, health);
  22. for(new i=0; i<MAX_PLAYERS; i++)
  23. {
  24. if(health >= 0 && !EVD_VehicleHasDriver(hitid))
  25. {
  26. if(weaponid == 22) SetVehicleHealth(hitid, health -25);
  27. if(weaponid == 23) SetVehicleHealth(hitid, health -40);
  28. if(weaponid == 24) SetVehicleHealth(hitid, health -120);
  29. if(weaponid == 25) SetVehicleHealth(hitid, health -150);
  30. if(weaponid == 26) SetVehicleHealth(hitid, health -80);
  31. if(weaponid == 27) SetVehicleHealth(hitid, health -60);
  32. if(weaponid == 28) SetVehicleHealth(hitid, health -20);
  33. if(weaponid == 29) SetVehicleHealth(hitid, health -25);
  34. if(weaponid == 30) SetVehicleHealth(hitid, health -30);
  35. if(weaponid == 31) SetVehicleHealth(hitid, health -35);
  36. if(weaponid == 32) SetVehicleHealth(hitid, health -20);
  37. if(weaponid == 33) SetVehicleHealth(hitid, health -75);
  38. if(weaponid == 34) SetVehicleHealth(hitid, health -125);
  39. if(weaponid == 35) SetVehicleHealth(hitid, health -1000);
  40. if(weaponid == 36) SetVehicleHealth(hitid, health -1000);
  41. if(weaponid == 37) SetVehicleHealth(hitid, health -200);
  42. if(weaponid == 38) SetVehicleHealth(hitid, health -100);
  43. if(health < 250 && EB[hitid] == 0)
  44. {
  45. SetTimerEx("EVD_RespawnVehicle", 10000, 0, "i", hitid);
  46. EB[hitid] = 1;
  47. }
  48. }
  49. }
  50. if(health <= 0 && HealthUnderZero[hitid] == 0)
  51. {
  52. HealthUnderZero[hitid] = 1;
  53. GetVehiclePos(hitid, X, Y, Z );
  54. CreateExplosion(X, Y, Z, 1, 5);
  55. }
  56. }
  57. }
  58. #if defined EVD_OnPlayerWeaponShot
  59. EVD_OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ );
  60. #endif
  61. return 1;
  62. }
  63.  
  64. #if defined _ALS_OnPlayerWeaponShot
  65. #undef OnPlayerWeaponShot
  66. #else
  67. #define _ALS_OnPlayerWeaponShot
  68. #endif
  69. #define OnPlayerWeaponShot EVD_OnPlayerWeaponShot
  70. #if defined EVD_OnPlayerWeaponShot
  71. forward EVD_OnPlayerWeaponShot( playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ );
  72. #endif
  73.  
  74. public OnVehicleSpawn(vehicleid)
  75. {
  76. HealthUnderZero[vehicleid] = 0;
  77. EB[vehicleid] = 0;
  78. SetVehicleHealth(vehicleid, 1000);
  79. #if defined EVD_OnVehicleSpawn
  80. EVD_OnVehicleSpawn(vehicleid);
  81. #endif
  82. return 1;
  83. }
  84.  
  85. #if defined _ALS_OnVehicleSpawn
  86. #undef OnVehicleSpawn
  87. #else
  88. #define _ALS_OnVehicleSpawn
  89. #endif
  90. #define OnVehicleSpawn EVD_OnVehicleSpawn
  91. #if defined EVD_OnVehicleSpawn
  92. forward EVD_OnVehicleSpawn(vehicleid);
  93. #endif
  94.  
  95. forward EVD_RespawnVehicle(vehicleid);
  96. public EVD_RespawnVehicle(vehicleid)
  97. {
  98. SetVehicleToRespawn(vehicleid);
  99. EB[vehicleid] = 0;
  100. return 1;
  101. }
  102.  
  103.  
  104. forward EVD_VehicleHasDriver(vehicleid);
  105. public EVD_VehicleHasDriver(vehicleid)
  106. {
  107. for(new i=0;i<=MAX_PLAYERS;i++)
  108. {
  109. if(IsPlayerInAnyVehicle(i))
  110. {
  111. if(GetPlayerVehicleID(i)==vehicleid)
  112. {
  113. if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
  114. {
  115. return 1;
  116. }
  117. }
  118. }
  119. }
  120. return 0;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement