#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#define GetPlayerBit(%1,%2) ( %1 & ( 1 << ( %2 & 31 ) ) )
#define SetPlayerBit(%1,%2) ( %1 |= ( 1 << ( %2 & 31 ) ) )
#define ClearPlayerBit(%1,%2) ( %1 &= ~( 1 << ( %2 & 31 ) ) )
const m_iId = 43;
const m_iType = 34;
const m_iMoney = 115;
const ARMOURY_HEGRENADE = 15;
const EXTRAOFFSET_WEAPONS = 4;
new g_iBought;
public plugin_init( )
{
register_plugin( "You will feel the pain", "1.0", "Manu" );
RegisterHam( Ham_Spawn, "player", "fw_PlayerSpawn_Post", true );
RegisterHam( Ham_AddPlayerItem, "player", "fw_PlayerItem_Pre", false );
}
public fw_PlayerSpawn_Post( iId )
{
ClearPlayerBit( g_iBought, iId );
}
public fw_PlayerItem_Pre( iIndex, iWeapon )
{
if( get_pdata_int( iWeapon, m_iId, EXTRAOFFSET_WEAPONS ) == CSW_HEGRENADE )
{
if( GetPlayerBit( g_iBought, iIndex ) )
{
client_print( iIndex, print_center, "* No puedes spammear granadas HE *" );
ExecuteHamB( Ham_TakeDamage, iIndex, 0, 0, 10.0, DMG_NEVERGIB );
set_pev( iWeapon, pev_flags, pev( iWeapon, pev_flags ) | FL_KILLME );
return HAM_SUPERCEDE;
}
else
SetPlayerBit( g_iBought, iIndex );
}
return HAM_IGNORED;
}