18/09/2015, 10:23 PM
(18/09/2015, 06:02 PM)Nazi.- escribió: [ -> ](18/09/2015, 05:59 PM)ImBuggimen escribió: [ -> ]el coco esta serca
cuentame mas
corrector del cell (?
me podrían decir si lo estoy haciendo bien ?
Código PHP:
enum _:D_WEAP { WNAME[ 90 ], VMDL[ 90 ], WEAPON_NAME[ 90 ], CSW }
enum _:WEAPONS { PRIMARY }
#include < amxmodx >
#include < hamsandwich >
#include < cstrike >
#include < fun >
#include < fakemeta >
const MAX = 33;
new const szWEAPONS[ ][ D_WEAP ] =
{
{ "zsTest", "default", "weapon_m4a1", CSW_M4A1 },
{ "szText2", "v_m4a1", "weapon_m3", CSW_M3 }
};
new iWeaponSelected[ MAX ][ WEAPONS char ];
public plugin_init( )
{
register_event( "CurWeapon", "event_CurWeapon", "be", "1=1" );
register_clcmd( "say /armas", "WPMenu" );
}
public plugin_precache( )
{
new b, szText[ 120 ];
for( b = 0; b < sizeof( szWEAPONS ); b++ )
{
if( ~( equal ( szWEAPONS[ b ][ VMDL ], "default" ) ) )
formatex( szText, charsmax( szText ), "models/%s.mdl", szWEAPONS[ b ][ VMDL ] );
precache_model( szText );
}
}
public client_putinserver( iUser )
{
iWeaponSelected[ iUser ]{ PRIMARY } = -1;
}
public WPMenu( iUser )
{
new b , iMenu, szText[ 120 ], len = 0;
iMenu = menu_create( "Elija su arma", "Handler_WPMenu" );
for( b = 0; b < sizeof( szWEAPONS ); b++ )
{
formatex( szText[ len ], charsmax( szText ) - len, "%s", szWEAPONS[ b ][ WNAME ] );
menu_additem( iMenu, szText );
}
menu_display( iUser, iMenu, 0 );
return PLUGIN_HANDLED;
}
public Handler_WPMenu( iUser, iMenu, iItem )
{
if( iItem == MENU_EXIT ) return PLUGIN_HANDLED;
iWeaponSelected[ iUser ]{ PRIMARY } = iItem;
give_item( iUser, szWEAPONS[ iItem ][ WEAPON_NAME ] );
return PLUGIN_HANDLED;
}
public event_CurWeapon( iOwner )
{
if( ~is_user_alive( iOwner ) )
return 1;
new WeaponInf = read_data( 2 );
if( WeaponInf == szWEAPONS[ iWeaponSelected[ iOwner ]{ PRIMARY } ][ CSW ] )
{
if( ~equal ( szWEAPONS[ iWeaponSelected[ iOwner ]{ PRIMARY } ][ VMDL ] , "default" ) )
set_pev( iOwner , pev_viewmodel2, szWEAPONS[ iWeaponSelected[ iOwner ]{ PRIMARY } ][ VMDL ] )
}
return 0
}