AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Simple Weapon menu (https://forums.alliedmods.net/showthread.php?t=106538)

Zpoke 10-16-2009 12:09

Simple Weapon menu
 
hello, can someone tell me how to make a simple weapon menu.

i mean a weapon menu that looks like CSDM's weapon menu :)


sorry for my english :(

FaktuM 10-16-2009 12:54

Re: Simple Weapon menu
 
Here you go, I didnt make the "menu". I hope that you know how to make it.
PHP Code:

#include < amxmodx >
#include < fun >

new const VERSION[ ] = "1.0"

new const WEAPONS[ ][ ] = 
{
    
"weapon_p228",
    
"weapon_scout",
    
"weapon_xm1014",
    
"weapon_mac10",
    
"weapon_aug",
    
"weapon_elite",
    
"weapon_fiveseven",
    
"weapon_ump45",
    
"weapon_sg550",
    
"weapon_galil",
    
"weapon_famas",
    
"weapon_usp",
    
"weapon_glock18",
    
"weapon_awp",
    
"weapon_mp5navy",
    
"weapon_m249",
    
"weapon_m3",
    
"weapon_m4a1",
    
"weapon_tmp",
    
"weapon_g3sg1",
    
"weapon_deagle",
    
"weapon_sg552",
    
"weapon_ak47",
    
"weapon_p90"
};

public 
plugin_init( )

    
register_plugin"Give Weapon"VERSION"FaktuM")
    
    
register_clcmd"say /weapons""GiveWeapons" );
}

public 
GiveWeaponsid )
{
    if ( 
is_user_aliveid ) )
        for ( new 
sizeofWEAPONS ) ; i++ )
            
give_itemidWEAPONS] );



vitorrd 10-16-2009 13:03

Re: Simple Weapon menu
 
Don't forget to give the player some ammo with cs_set_user_bpammo.

FaktuM 10-16-2009 13:14

Re: Simple Weapon menu
 
Quote:

Originally Posted by vitorrd (Post 963865)
Don't forget to give the player some ammo with cs_set_user_bpammo.

If you wish, you can add that. Zpoke (talked to him @ steam) just want this code snippet to hes Kz training plugin, so I dont think its necessary with ammo. :)

Xellath 10-16-2009 14:20

Re: Simple Weapon menu
 
Code:
#include < amxmodx > #include < fun > new const VERSION[ ] = "0.1.0"; new const g_szWeaponConstNames[ ][ ] = {     "weapon_usp",     "weapon_hegrenade",     "weapon_m4a1",     "weapon_awp",     "weapon_deagle" }; new const g_szWeaponNames[ ][ ] = {     "USP",     "HE Grenade",     "M4A1",     "AWP",     "Deagle" }; new g_hWeaponMenu; public plugin_init( ) {     register_plugin( "Weapon Menu", VERSION, "Xellath" );         register_clcmd( "say /weapons", "weaponMenu" );         new szNumber[ 3 ];         g_hWeaponMenu = menu_create( "Weapon Menu", "weaponHandler" );         for ( new i; i < sizeof( g_szWeaponNames ); i++ )     {         num_to_str( i, szNumber, charsmax( szNumber ) );                 menu_additem( g_hWeaponMenu, g_szWeaponNames[ i ], szNumber );     } } public weaponMenu( iClient ) {     if ( is_user_alive( iClient ) )     {         menu_display( iClient, g_hWeaponMenu, 0 );     } } public weaponHandler( iClient, hMenu, iItem ) {     if ( iItem == MENU_EXIT )     {         menu_destroy( hMenu );         return PLUGIN_HANDLED;     }         new szData[ 6 ];     new iAccess, iCallback;         menu_item_getinfo( hMenu, iItem, iAccess, szData, 5, _, _, iCallback );         if ( is_user_alive( iClient ) )         give_item( iClient, g_szWeaponConstNames[ str_to_num( szData ) ] );         return PLUGIN_HANDLED; }

EDIT: Fixed, thanks Exo.


All times are GMT -4. The time now is 22:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.