Blocking the next throw grenades if the previous shots in less than 15 seconds.
PHP Code:
/* Plugin generated by AMXX-Studio */
#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 )
#define m_flNextAttack 83
#define OFFSET_LINUX_WEAPONS 4
#define OFFSET_LINUX 5
#define OFFSET_WEAPONOWNER 41
new Float: g_fWaitTime[33];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam( Ham_Item_Deploy, "weapon_hegrenade", "Deploy_Post", .Post = true );
}
public Deploy_Post( pEntity )
{
if( !IsValidPrivateData( pEntity ) )
{
return HAM_HANDLED;
}
new id = get_pdata_cbase( pEntity , OFFSET_WEAPONOWNER , OFFSET_LINUX_WEAPONS );
new Float:Time = get_gametime() - g_fWaitTime[id];
if(Time < 15)
{
client_print(id, print_center, "Please, wait %0f seconds", 15 - Time);
set_pdata_float(id, m_flNextAttack, get_gametime( ), OFFSET_LINUX );
}
return HAM_IGNORED;
}
public grenade_throw(id, gid, wid)
{
if(wid != CSW_HEGRENADE)
return;
g_fWaitTime[id] = get_gametime();
}