Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Realistic Bullet Damage 2.3_02

By: a guest on Mar 10th, 2012  |  syntax: PAWN  |  size: 2.59 KB  |  views: 698  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <a_samp>
  2. #define MAX_HEALTH 100
  3. #define MAX_ARMOUR 100
  4.  
  5. enum WeapInfo
  6. {
  7. Weapid,
  8. Damage,
  9. WeaponName[35],
  10. ArmourDamage
  11. }
  12. new Weapons[55][WeapInfo] = { // thanks to sa-mp wiki for these weapon ids
  13. {0,10,"Unarmed",10},
  14. {1,20,"Brass Knuckles",15},
  15. {2,35,"Golf Club",30},
  16. {3,35,"Nite Stick",35},
  17. {4,50,"Knife",45},
  18. {5,40,"Baseball Bat",35},
  19. {6,30,"Shovel",30},
  20. {7,30,"Pool Cue",30},
  21. {8,100,"Katana",90},
  22. {9,50,"Chainsaw",44},
  23. {10,5,"Purple Dildo",3},
  24. {11,5,"Small White Vibrator",3},
  25. {12,10,"Large White Vibrator",5},
  26. {13,5,"Silver Vibrator",3},
  27. {14,5,"Flowers",3},
  28. {15,25,"Cane",20},
  29. {16,100,"Grenade",90},
  30. {17,50,"Tear Gas",20},
  31. {18,50,"Molotov Coctail",20},
  32. {19,0,"Invalid Weapon",0},
  33. {20,0,"Invalid Weapon",0},
  34. {11,0,"Invalid Weapon",0},
  35. {22,40,"Colt 9mm",40},
  36. {23,40,"Silenced Colt 9mm",40},
  37. {24,45,"Desert Eagle",45},
  38. {25,50,"Shotgun",45},
  39. {26,50,"Sawn-off Shotgun",45},
  40. {27,60,"Combat Shotgun",50},
  41. {28,35,"Micro SMG",30},
  42. {29,35,"MP5K",35},
  43. {30,40,"AK-47",40},
  44. {31,40,"M4",40},
  45. {32,30,"Tec9",25},
  46. {33,100,"Country Rifle",90},
  47. {34,100,"Sniper Rifle",90},
  48. {35,100,"Rocket Launcher",90},
  49. {36,100,"HS Rocket Launcher",90},
  50. {37,30,"Flamethrower",20},
  51. {38,50,"Minigun",50},
  52. {39,100,"Satchel Charge",100}, //might not be synced
  53. {40,10,"Satchel Detonator",10}, //might not be synced
  54. {41,10,"Spraycan",10},
  55. {42,15,"Fire Extinguisher",15},
  56. {43,0,"Camera",0},
  57. {44,0,"Nightvision Goggles",0},
  58. {45,0,"Thermal Goggles",0},
  59. {46,100,"Thermal Goggles",100},
  60. {47,100,"Fake Pistol",100},
  61. {48,0,"Invalid Weapon",0},
  62. {49,50,"Vehicle",60},
  63. {50,200,"Heli-Blades",200},
  64. {51,100,"Explosion",100},
  65. {52,0,"Invalid Weapon",0},
  66. {53,20,"Drowned",25},
  67. {54,0,"Splat",0} // default damage on splat
  68. };
  69.  
  70. public OnFilterScriptInit()
  71. {
  72.         print("\n--------------------------------------");
  73.         print(" Realistic Weapon Damage R2 ");
  74.         print("--------------------------------------\n");
  75.         return 1;
  76. }
  77.  
  78. public OnFilterScriptExit()
  79. {
  80.         return 1;
  81. }
  82. public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
  83. {
  84.         if(issuerid != INVALID_PLAYER_ID)
  85.         {
  86.                 new Float:Health,Float:Armour;
  87.                 GetPlayerHealth(playerid,Health);
  88.                 GetPlayerArmour(playerid,Armour);
  89.                 if(Health == 0)
  90.                 {
  91.                         SendDeathMessage(issuerid,playerid,weaponid);
  92.                 }
  93.                 else if(Armour > 0)
  94.                 {
  95.                         SetPlayerArmour(playerid,Armour+amount);
  96.                         GetPlayerArmour(playerid,Armour);
  97.                         SetPlayerArmour(playerid,Armour-Weapons[weaponid][ArmourDamage]);
  98.                 } else {
  99.                         SetPlayerHealth(playerid,Health+amount);
  100.                         GetPlayerHealth(playerid,Health);
  101.                         SetPlayerHealth(playerid,Health-Weapons[weaponid][Damage]);
  102.                 }
  103.         }
  104.         return 1;
  105. }