Quote:
Originally Posted by xbatista
Compiles bad...fwd_touch should return a value and a value that is never used: "plr"
|
sry made a couple of mistakes cuz i had to hurry :/ this should work now
PHP Code:
#include <amxmodx>
#include <fakemeta>
new g_AllowedWeapons[][] =
{
"weapon_mac10",
"weapon_elite",
"weapon_m3",
"weapon_m4a1"
}
new g_iMaxPlayers;
public plugin_init( )
{
register_forward( FM_Touch, "fwdTouch" );
g_iMaxPlayers = get_maxplayers( );
}
// the plr can touch the ent AND the ent can touch the player so we need to supercede both
public fwdTouch( touched, toucher )
{
static ent;
// find out whether the toucher or touched is the plr
if( toucher <= g_iMaxPlayers )
ent = touched;
else if( touched <= g_iMaxPlayers )
ent = toucher;
else // an ent touched an ent, no plr is involved
return FMRES_IGNORED;
static classname[32];
pev( ent, pev_classname, classname, 31 );
// check the ent for it's classname
if( equal( classname, "weapon_", 7 ) )
{
for(new i;i < sizeof(g_AllowedWeapons);i++)
{
if( equal( classname[7], g_AllowedWeapons[i][7] ) )
{
return FMRES_IGNORED;
}
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
__________________