#include <amxmodx>
#include <csx>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "Gránát eldobás késleltetése"
#define VERSION "2.1"
#define AUTHOR "FromTheFuture"
const XO_CBASEPLAYERITEM = 4;
const m_pPlayer = 41;
const XO_CBASEPLAYERWEAPON = 4;
const m_flNextPrimaryAttack = 46;
new Float: g_fNextThrowTime[33];
new g_CvarTime;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_CvarTime = register_cvar("amx_he_blocktime", "10.0");
RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_hegrenade", "OnCHEGrenade_PrimaryAttack", false );
}
public OnCHEGrenade_PrimaryAttack( pEntity )
{
new id = get_pdata_cbase( pEntity , m_pPlayer , XO_CBASEPLAYERITEM );
new Float:flWaitTime = g_fNextThrowTime[id] - get_gametime();
if( flWaitTime > 0.0 )
{
client_print(id, print_center, "A következő gránát eldobásáig várnod kell %d másodpercet!", floatround(flWaitTime));
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public grenade_throw(id, gid, wid)
{
if(wid == CSW_HEGRENADE)
{
g_fNextThrowTime[id] = get_gametime() + get_pcvar_float(g_CvarTime);
}
}