[TUT] How To Create a Menu inside Another One
Jan 26, 2018 3:59:22 GMT 5.5
via mobile
P!KaChu~ and LIL ZINN like this
Post by K!nG on Jan 26, 2018 3:59:22 GMT 5.5
Hello EveryOne...
This is My First Post on Csindia.boards.net .
So i Hope i help You Guys...
Today i'll Show You How to Create a Menu inside Another Menu ...
Example :
Say /menu
Will open :
1. Weapons Menu (Ak47, m4a1..etc)
2. Items Menu (Armor , hp...etc)
Follow My Steps :
1. Put Includes
3. Register The plugin and add menu open cmnd :
4. Creat the menu :
5. Make The Menu Action (PlayerMenu) :
6. Create The weapons Menu (case 0) :
7. Make Action for Weapons menu :
8. Create Items Menu :
9. Make Action for Items menu :
Finnaly It's done (coding with phone), now Compile it ..
If Errors/bugs Comment below
This is My First Post on Csindia.boards.net .
So i Hope i help You Guys...
Today i'll Show You How to Create a Menu inside Another Menu ...
Example :
Say /menu
Will open :
1. Weapons Menu (Ak47, m4a1..etc)
2. Items Menu (Armor , hp...etc)
Follow My Steps :
1. Put Includes
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <cstrike>
#include <fun>
3. Register The plugin and add menu open cmnd :
public plugin_init()
{
// register Plugin name , Version eg: 1.0 , Author(Creater Name)
register_plugin("PluginName", "Version", "Author")
// Register menu Cmnd (say /test)
register_clcmd("say /menu", "TestMenu")
}
4. Creat the menu :
public TestMenu(id)
{
new menu = menu_create("Player Menu", "PlayerMenu")
menu_additem(menu, "[Weapons Menu]", "1", 0) // case 0
menu_additem(menu, " [Weapons Menu]", "2", 0) // case 1
}
5. Make The Menu Action (PlayerMenu) :
public PlayerMenu(id, menu, item)
{
if(item == MENU_EXIT)
{
return PLUGIN_HANDLED
}
switch(item)
{
case 0:
{
WeaponsMenu(id)
}
case 1:
{
ItemsMenu(id)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
6. Create The weapons Menu (case 0) :
public WeaponsMenu(id)
{
new menu = menu_create("Weapons Menu :", " Weapons_Menu")
menu_additem(menu, "\wAK47 \r[Free]", "1", 0) // case 0
menu_additem(menu, "\wM4a1 \r[Free]", "2", 0) // case 1
menu_additem(menu, "\wAwp \r[Free]", "3", 0) // case 2
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
7. Make Action for Weapons menu :
public WeaponsMenu(id, menu, item)
{
if(item == MENU_EXIT)
{
return PLUGIN_HANDLED
}
switch(item)
{
case 0:
{
Client_print(id, print_chat, "You Got Free Ak47")
give_item(id, " weapon_ak47")
}
case 1:
{
Client_print(id, print_chat, "You Got Free M4a1")
give_item(id, " weapon_m4a1")
}
case 2:
{
Client_print(id, print_chat, "You Got Free Awp")
give_item(id, " weapon_awp")
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
8. Create Items Menu :
public ItemsMenu(id)
{
new menu = menu_create("Items Menu :", "Items_Menu")
menu_additem(menu, "\w200 Armor \r[Free]", "1", 0) // case 0
menu_additem(menu, "\w200 Health \r[Free]", "2", 0) case 1
menu_additem(menu, "\w50 Frags [Free]", "3", 0) // case 2
menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
9. Make Action for Items menu :
public ItemsMenu(id, menu, item)
{
if(item == MENU_EXIT)
{
return PLUGIN_HANDLED
}
switch(item)
{
case 0:
{
Client_print(id, print_chat, "You Got Free 200 Armor")
get_user_armor(id, 200)
}
case 1:
{
Client_print(id, print_chat, "You Got Free 200 Health")
get_user_health(id, 200)
}
case 2:
{
Client_print(id, print_chat, "You Got Free 50 Frags")
get_user_frags(id, 50)
}
}
menu_destroy(menu)
return PLUGIN_HANDLED
}
Finnaly It's done (coding with phone), now Compile it ..
If Errors/bugs Comment below