HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <csx>
  3. #include <hamsandwich>
  4. #include <fakemeta>
  5.  
  6. #define PLUGIN "Gránát eldobás késleltetése"
  7. #define VERSION "2.1"
  8. #define AUTHOR "FromTheFuture"
  9.  
  10. const XO_CBASEPLAYERITEM = 4;
  11. const m_pPlayer = 41;
  12.  
  13. const XO_CBASEPLAYERWEAPON = 4;
  14. const m_flNextPrimaryAttack = 46;
  15.  
  16. new Float: g_fNextThrowTime[33];
  17. new g_CvarTime;
  18.  
  19. public plugin_init()
  20. {
  21. register_plugin(PLUGIN, VERSION, AUTHOR);
  22. g_CvarTime = register_cvar("amx_he_blocktime", "10.0");
  23. RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_hegrenade", "OnCHEGrenade_PrimaryAttack", false );
  24. }
  25.  
  26. public OnCHEGrenade_PrimaryAttack( pEntity )
  27. {
  28. new id = get_pdata_cbase( pEntity , m_pPlayer , XO_CBASEPLAYERITEM );
  29. new Float:flWaitTime = g_fNextThrowTime[id] - get_gametime();
  30.  
  31. if( flWaitTime > 0.0 )
  32. {
  33. client_print(id, print_center, "A következő gránát eldobásáig várnod kell %d másodpercet!", floatround(flWaitTime));
  34. return HAM_SUPERCEDE;
  35. }
  36. return HAM_IGNORED;
  37. }
  38.  
  39. public grenade_throw(id, gid, wid)
  40. {
  41. if(wid == CSW_HEGRENADE)
  42. {
  43. g_fNextThrowTime[id] = get_gametime() + get_pcvar_float(g_CvarTime);
  44. }
  45. }