Code:
#include < amxmodx >
#include < fakemeta >
new const g_iNadeConstants[ 3 ] =
{
CSW_HEGRENADE,
CSW_FLASHBANG,
CSW_SMOKEGRENADE
};
new const g_szNadeModels[ 3 ][ ] =
{
"models/w_hegrenade.mdl",
"models/w_flashbang.mdl",
"models/w_smokegrenade.mdl";
};
new Trie:g_tNadeModels;
public plugin_init( )
{
g_tNadeModels = TrieCreate( );
for( new i = 0; i < 3; i++ )
{
TrieSetCell( g_tNadeModels, g_szNadeModels[ i ], i );
}
register_forward( FM_SetModel, "FwdSetModel", 1 );
}
public plugin_end( )
{
TrieDestroy( g_tNadeModels );
}
public FwdSetModel( iEntity, const szModel[ ] )
{
if( pev_vaild( iEntity ) )
{
new iOwner = pev( iEntity, pev_owner );
if( is_user_connected( iOwner ) )
{
static Float:fExplodeTime;
pev( iEntity, pev_dmgtime, fExplodeTime );
if( fExplodeTime > 0.0 )
{
static iIndex;
if( TrieGetCell( g_tNadeModels, szModel, iIndex ) )
{
new CSW_nadetype = g_iNadeConstants[ iIndex ];
// iEntity = the grenade entity
// CSW_nadetype = the CSW_* constant for the nade type
// iOwner = the thrower
}
}
}
}
}
__________________