set m_flNextPrimaryAttack on grenade entity then.
Gonna be a little animation starting to play due to client prediction.
PHP Code:
#include <amxmodx>
// #include <amxmisc>
#include <csx>
#include <hamsandwich>
#include <fakemeta>
#define PLUGIN "HeBlock"
#define VERSION "1.0"
#define AUTHOR "FromTheFuture"
#define IsValidPrivateData(%0) ( pev_valid( %0 ) == 2 )
const XO_CBASEPLAYERITEM = 4;
const m_pPlayer = 41;
const XO_CBASEPLAYERWEAPON = 4;
const m_flNextPrimaryAttack = 46;
new Float: g_fNextThrowTime[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
RegisterHam( Ham_Item_Deploy, "weapon_hegrenade", "OnCHEGrenadeDeploy_Post", true );
}
public OnCHEGrenadeDeploy_Post( pEntity )
{
if( !IsValidPrivateData( pEntity ) )
{
return;
}
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, "Please, wait %.0f seconds", flWaitTime);
set_pdata_float(pEntity, m_flNextPrimaryAttack, flWaitTime, XO_CBASEPLAYERWEAPON);
}
}
public grenade_throw(id, gid, wid)
{
if(wid == CSW_HEGRENADE)
{
g_fNextThrowTime[id] = get_gametime() + 15.0;
}
}
__________________