HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1.  
  2. #include <amxmodx>
  3. #include <amxmisc>
  4. #include <hamsandwich>
  5. #include <fakemeta>
  6. #include <fakemeta_stocks>
  7.  
  8. #define PLUGIN "Helmet Hit Sound"
  9. #define AUTHOR "tmen13"
  10. #define VERSION "1.0"
  11.  
  12. #define OFFSET_ARMORTYPE 112
  13. #define fm_get_user_armor_type(%1) get_pdata_int(%1, OFFSET_ARMORTYPE)
  14.  
  15. new MAX_PLAYERS;
  16.  
  17. new const SOUND[] = "misc/helmet.wav";
  18.  
  19. public plugin_cfg()
  20. {
  21. MAX_PLAYERS = get_maxplayers();
  22. }
  23. public plugin_init()
  24. {
  25. register_plugin(PLUGIN, VERSION, AUTHOR)
  26. RegisterHam(Ham_TakeDamage, "player", "playerTakeDamage");
  27. }
  28. public plugin_precache()
  29. {
  30. precache_sound(SOUND)
  31. }
  32. public playerTakeDamage(victim, inflictor, attacker, Float:fDamage, bitDamage)
  33. {
  34. if( (1 <= victim <= MAX_PLAYERS) && (1 <= attacker <= MAX_PLAYERS) && is_user_connected(victim))
  35. {
  36. new gun,hitZone
  37. get_user_attacker(victim,gun,hitZone)
  38.  
  39. if( (fm_get_user_armor_type(victim) & 2) && (hitZone == HIT_HEAD))
  40. {
  41. new Float:origin[3];
  42. pev(victim,pev_origin,origin);
  43.  
  44. EF_EmitAmbientSound(0,origin,SOUND, 1.0, ATTN_NORM, 0 , PITCH_NORM);
  45. }
  46. }
  47. }