Raised This Month: $ Target: $400
 0% 

Solved [HELP] Buy weapon menu...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-29-2017 , 19:30   [HELP] Buy weapon menu...
Reply With Quote #1

Hy, I'm trying do this to make a weapons buy menu but I dont know how to get what weapon the player has selected. Any idea?

PHP Code:
#include <amxmodx>
#include <fun>

new const WEAPON_ENT_NAMES[][] =
{
    
"weapon_ak47",
    
"weapon_m4a1"
}

new const 
WEAPON_NAMES[sizeof(WEAPON_ENT_NAMES)][] =
{
    
"Ak-47",
    
"M4a1"
}

public 
plugin_init()
{
    
register_clcmd("say menu""show_menu_game");
}

public 
menu_game(idmenuitem)
{
    new 
weapon[32];
    
    
// And here, what I need do??
    
    
give_item(idweapon);
    
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
}

public 
show_menu_game(id)
{
    new 
menu menu_create("Title of menu""menu_game");
    
    for (new 
0sizeof (WEAPON_NAMES); i++)
        
menu_additem(menuWEAPON_NAMES[i], ""0);
        
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
    
menu_displayidmenu);
    
    return 
PLUGIN_HANDLED;

__________________









Last edited by CrazY.; 03-30-2017 at 18:16.
CrazY. is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-29-2017 , 20:06   Re: [HELP] Buy weapon menu...
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

enum eWeapons
{
    
szWeaponName[10],
    
szWeaponIndex[17],
    
cswWeapon,
    
iWeaponBpAmmo
}

new const 
sWeapons[][eWeapons] =
{
    { 
"AK47""weapon_ak47"CSW_AK4790 },
    { 
"M4A1""weapon_m4a1"CSW_M4A190 }
}

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /menu""cmdMenu")
}

public 
cmdMenu(id)
{
    new 
iMenu menu_create("Weapons Menu""menu_weap_handler")
    
    for(new 
i;sizeof sWeapons;i++)
    {
        
menu_additem(iMenusWeapons[i][szWeaponName])
    }
    
    
menu_display(idiMenu)
    return 
PLUGIN_HANDLED
}

public 
menu_weap_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    
give_item(idsWeapons[item][szWeaponIndex])
    
cs_set_user_bpammo(idsWeapons[item][cswWeapon], sWeapons[item][iWeaponBpAmmo])
    
    
client_print(idprint_chat"You selected the %s"sWeapons[item][szWeaponName])
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-29-2017 , 20:26   Re: [HELP] Buy weapon menu...
Reply With Quote #3

Well.. I will test that after.. Thanks.
__________________








CrazY. is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-30-2017 , 15:16   Re: [HELP] Buy weapon menu...
Reply With Quote #4

Thank you, work!

One more thing, how to add a multi lingual system into menu? Example:

Code:
new menu = menu_create("%L", LANG_PLAYER, "MENU_TITLE", " menu_handler");
__________________








CrazY. is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-30-2017 , 15:50   Re: [HELP] Buy weapon menu...
Reply With Quote #5

Code:
new szBuffer[ 64 ] ; formatex( szBuffer, charsmax( szBuffer ), "%L", id, "MENU_TITLE") ;   new menu = menu_create( szBuffer, "menu_handler" ) ;
__________________

Last edited by edon1337; 03-31-2017 at 04:56.
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 03-30-2017 , 17:12   Re: [HELP] Buy weapon menu...
Reply With Quote #6

PHP Code:
formatexszBuffercharsmaxszBuffer ), "%L"id"MENU_TITTLE") ; 
https://wiki.alliedmods.net/Advanced...ingual_Support
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-30-2017 , 18:14   Re: [HELP] Buy weapon menu...
Reply With Quote #7

Thank you! Solved.
__________________








CrazY. is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:51.


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