I'm getting this error
Code:
[AMXX] Run time error 3: stack error
and if i remove this line
Code:
engclient_cmd ( id, "drop", gs_WeaponsName[ i_Index ] );
it works fine
here's the code
PHP Code:
#include < amxmodx >
#include < engine >
#include < fakemeta >
#define PLUGIN "New Plug-In"
#define VERSION "0.1"
#define AUTHOR "Author"
new const gs_Weapons[ ] =
{
CSW_AK47,
CSW_M4A1,
CSW_MP5NAVY
};
new const gs_WeaponsName[ ][ ] =
{
"weapon_ak47",
"weapon_m4a1",
"weapon_mp5navy"
};
new gi_MaxPlayers;
public plugin_init ( )
{
register_plugin ( PLUGIN, VERSION, AUTHOR );
gi_MaxPlayers = get_maxplayers ( );
new s_Map[ 32 ];
get_mapname ( s_Map, 31 );
if ( containi ( s_Map, "awp_bycastor" ) > -1 )
register_event ( "CurWeapon","HookCurWeapon", "be", "1=1" );
}
public HookCurWeapon ( id )
{
if ( ! is_user_alive ( id ) )
return 0;
static i_CurWeapon, i_Box, i_Weapon;
i_CurWeapon = read_data ( 2 );
for ( new i_Index; i_Index < sizeof gs_Weapons; i_Index++ )
{
if ( i_CurWeapon == gs_Weapons[ i_Index ] )
{
engclient_cmd ( id, "drop", gs_WeaponsName[ i_Index ] );
i_Weapon = find_ent_by_class ( -1, gs_WeaponsName[ i_Index ] );
i_Box = pev ( i_Weapon, pev_owner );
if ( i_Weapon && i_Box > gi_MaxPlayers )
dllfunc ( DLLFunc_Think, i_Box );
}
}
return 0;
}
__________________