How can I change armoury_entities bpammo when they spawn? I want that all armoury_entities spawn with their max bpammo. Sorry for my english...
I tried:
PHP Code:
#include < amxmodx >
#include < fakemeta >
new const g_iMaxBpAmmo[ ] =
{
0, 30, 90, 200, 90,
32, 100, 100, 35, 52,
120, 2, 1, 1, 1
}
const m_iPrimaryAmmoType = 49
const m_iDefaultAmmo = 56
new g_iFwdPrecacheSpawn;
public plugin_precache( )
{
g_iFwdPrecacheSpawn = register_forward( FM_Spawn, "FwdPrecacheSpawn", 1 );
}
public plugin_init( )
{
register_plugin( "armoury_entity max bpammo", "1.0", "!-Radio-man" );
unregister_forward( FM_Spawn, g_iFwdPrecacheSpawn, 1 );
}
public FwdPrecacheSpawn( iEnt )
{
if( !pev_valid( iEnt ) )
{
return FMRES_IGNORED;
}
static szClass[ 15 ];
pev( iEnt, pev_classname, szClass, 14 );
if( !equal( szClass, "armoury_entity" ) )
{
return FMRES_IGNORED;
}
set_pdata_int( iEnt, m_iDefaultAmmo, g_iMaxBpAmmo[ get_pdata_int( iEnt, m_iPrimaryAmmoType, 4 ) ], 4 );
return FMRES_IGNORED;
}