Raised This Month: $51 Target: $400
 12% 

Solved [Help] Need to improve Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
anash
Junior Member
Join Date: May 2018
Old 05-23-2018 , 19:42   [Help] Need to improve Menu
Reply With Quote #1

Hello.
This is a simple menu code that i found, it only shows a menu when players say /menu,
I have 0 knowledge about coding or scripting.
I want the menu to give only one item per round, and it should be accessible only in the buy time, or for 15 seconds from the beginning of the round

Code:
// Generated with v3x's AMXX Menu Generator

#include <amxmodx>

public plugin_init()
{
	register_plugin("My Menu", "1.0", "Me");
	register_clcmd("say /menu", "ShowMenu", _, "");
}

public ShowMenu(id)
{
	new menu = menu_create("SUPER GAMING MENU", "MENU");

	menu_additem(menu, "Armor ", "", 0); // case 0
	menu_additem(menu, "Hegrenade 1", "", 0); // case 1
	menu_additem(menu, "Flash 1", "", 0); // case 2
	menu_additem(menu, "Extra Money +800$", "", 0); // case 3
	menu_additem(menu, "Extra Ammo  Primary + Secondary", "", 0); // case 4
	menu_additem(menu, "", "", 0); // case 5

	menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
	menu_setprop(menu, MPROP_PERPAGE, 5);
	menu_setprop(menu, MPROP_NOCOLORS, 1);

	menu_display(id, menu, 0);

	return PLUGIN_HANDLED;
}

public MENU(id, menu, item)
{
	if(item == MENU_EXIT)
	{
		menu_cancel(id);
		return PLUGIN_HANDLED;
	}

	new command[6], name[64], access, callback;

	menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);

	switch(item)
	{
		case 0: client_print(id, print_chat, "You have selected Armor ");
		case 1: client_print(id, print_chat, "You have selected Hegrenade 1");
		case 2: client_print(id, print_chat, "You have selected Flash 1");
		case 3: client_print(id, print_chat, "You have selected Extra Money +800$");
		case 4: client_print(id, print_chat, "You have selected Extra Ammo  Primary + Secondary");
		case 5: client_print(id, print_chat, "You have selected ");
	}

	menu_destroy(menu);

	return PLUGIN_HANDLED;
}
Thanks in advance

Last edited by anash; 05-23-2018 at 23:05.
anash is offline
iceeedr
Veteran Member
Join Date: Apr 2017
Location: Brazil
Old 05-23-2018 , 21:09   Re: [Help] Need to improve Menu
Reply With Quote #2

PHP Code:
// Generated with v3x's AMXX Menu Generator

#include <amxmodx>
#include <cstrike>
#include <fun>

new bool:gCanBuy
new gBuyTime
public plugin_init()
{
    
register_plugin("My Menu""1.0""Me");
    
register_clcmd("say /menu""ShowMenu"_"");
    
gBuyTime get_cvar_pointer("mp_buytime")
    
register_event("HLTV","EventNewRnd""a""1=0""2=0")
}

public 
ShowMenu(id)
{
    new 
menu menu_create("SUPER GAMING MENU""MENU");

    
menu_additem(menu"Armor """0); // case 0
    
menu_additem(menu"Hegrenade 1"""0); // case 1
    
menu_additem(menu"Flash 1"""0); // case 2
    
menu_additem(menu"Extra Money +800$"""0); // case 3
    
menu_additem(menu"Extra Ammo  Primary + Secondary"""0); // case 4
    
menu_additem(menu""""0); // case 5

    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_setprop(menuMPROP_PERPAGE5);
    
menu_setprop(menuMPROP_NOCOLORS1);

    
menu_display(idmenu0);

    return 
PLUGIN_HANDLED;
}

public 
MENU(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }

    if(
gBuyTime && gCanBuy)
    {
        new 
command[6], name[64], accesscallback;
    
        
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);
    
        switch(
item)
        {
            case 
0
            {
                
client_print(idprint_chat"You have selected Armor ");
                
cs_set_user_armor(id100CS_ARMOR_VESTHELM)
            }
            case 
1
            {
                
client_print(idprint_chat"You have selected Hegrenade 1");
                
give_item(id"weapon_hegrenade"
            }
            case 
2:
            {
                
client_print(idprint_chat"You have selected Flash 1");
                
give_item(id"weapon_flashbang"
            }
            case 
3:
            {
                
client_print(idprint_chat"You have selected Extra Money +800$");
                
cs_set_user_money(id,(cs_get_user_money(id) + 800))
            }
            case 
4
            {
                
client_print(idprint_chat"You have selected Extra Ammo  Primary + Secondary");
            }
            case 
5:
            {
                
client_print(idprint_chat"You have selected ");
            }
        }
    
        
menu_destroy(menu);
        
gCanBuy false
    
        
return PLUGIN_HANDLED;
    }
    
client_print(idprint_chat"Purchase time is over or you have already purchased in this round.")
    return 
PLUGIN_HANDLED;
}

public 
EventNewRnd()
    
gCanBuy true 
iceeedr is offline
Send a message via Skype™ to iceeedr
anash
Junior Member
Join Date: May 2018
Old 05-23-2018 , 23:04   Re: [Help] Need to improve Menu
Reply With Quote #3

Bro , Thank you very much
anash 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 05:33.


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