Guest User

UnOccupied Vehicle Damage

a guest
Jun 21st, 2014
950
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define FILTERSCRIPT
  4.  
  5. #define DEAGLE_DAMAGE 60
  6. #define COMBATSHOTGUN_DAMAGE 64
  7. #define SHOTGUN_DAMAGE 52
  8. #define MP5_DAMAGE 28
  9. #define SNIPER_DAMAGE 45
  10. #define RIFLE_DAMAGE 38
  11. #define M4_DAMAGE 35
  12. #define AK47_DAMAGE 30
  13. #define MINIGUN_DAMAGE 500
  14.  
  15.  
  16. public OnFilterScriptInit()
  17. {
  18. printf("Unoccupied Vehicle Damage Loaded");
  19. return 1;
  20. }
  21. public OnFilterScriptExit()
  22. {
  23. printf("Unoccupied Vehicle Damage UnLoaded");
  24. return 1;
  25. }
  26.  
  27.  
  28. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  29. {
  30. if(hittype == 2)
  31. {
  32. if(!IsAnOccupiedVehicle(hitid))
  33. {
  34. new Float:hp;
  35. GetVehicleHealth(hitid, Float:hp);
  36. if(weaponid == 24)
  37. {
  38. SetVehicleHealth(hitid, hp-DEAGLE_DAMAGE);
  39. }
  40. if(weaponid == 25)
  41. {
  42. SetVehicleHealth(hitid, hp-SHOTGUN_DAMAGE);
  43. }
  44. if(weaponid == 27)
  45. {
  46. SetVehicleHealth(hitid, hp-COMBATSHOTGUN_DAMAGE);
  47. }
  48. if(weaponid == 29)
  49. {
  50. SetVehicleHealth(hitid, hp-MP5_DAMAGE);
  51. }
  52. if(weaponid == 30)
  53. {
  54. SetVehicleHealth(hitid, hp-AK47_DAMAGE);
  55. }
  56. if(weaponid == 31)
  57. {
  58. SetVehicleHealth(hitid, hp-M4_DAMAGE);
  59. }
  60. if(weaponid == 33)
  61. {
  62. SetVehicleHealth(hitid, hp-RIFLE_DAMAGE);
  63. }
  64. if(weaponid == 34)
  65. {
  66. SetVehicleHealth(hitid, hp-SNIPER_DAMAGE);
  67. }
  68. if(weaponid == 38)
  69. {
  70. SetVehicleHealth(hitid, hp-MINIGUN_DAMAGE);
  71. }
  72. }
  73. }
  74. return 1;
  75. }
  76.  
  77. stock IsAnOccupiedVehicle(vehicleid)
  78. {
  79. for(new e = 0; e < MAX_PLAYERS; e++)
  80. {
  81. if(IsPlayerInAnyVehicle(e) && GetPlayerState(e) == PLAYER_STATE_DRIVER)
  82. {
  83. if(GetPlayerVehicleID(e) == vehicleid) return 0;
  84. else return 1;
  85. }
  86. }
  87. return 0;
  88. }
Advertisement
Add Comment
Please, Sign In to add comment