AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help me to create Menu (https://forums.alliedmods.net/showthread.php?t=172841)

made.tn 11-26-2011 13:56

Help me to create Menu
 
Please help me to create this plugin

description:
Quote:

Menu Item1:Give 100hp
Menu Item2:Give 500hp
Menu Item3: Give 1000hp

And thanks :)

drekes 11-26-2011 14:13

Re: Help me to create Menu
 
http://forums.alliedmods.net/showthread.php?t=46364

made.tn 11-26-2011 14:15

Re: Help me to create Menu
 
thanks

MyPc 11-26-2011 14:16

Re: Help me to create Menu
 
Quote:

Originally Posted by made.tn (Post 1603143)
Please help me to create this plugin

description:


And thanks :)

Code:

#include <amxmodx>
#include <fun>

public plugin_init()
{
        register_clcmd("say /menu", "menu")
}

public menu(id)
{
        new menu = menu_create("Menu Name", "menu_handler")
       
        menu_additem(menu, "Give 100 hp ", "1")
        menu_additem(menu, "Give 500 hp ", "2")
        menu_additem(menu, "Give 1000 hp ", "3")
       
        menu_display(id, menu, 0)
}

public menu_handler(id, menu, item)
{
        new maxdata[64], maxnames[64], access, callback
       
        menu_item_getinfo(menu, item, access, maxdata, sizeof maxdata - 1, maxnames, sizeof maxnames - 1, callback)
       
        new key = str_to_num(maxdata)
        new health = get_user_health(id)
       
        switch (key)
        {
                case 1:
                {
                        set_user_health(id, health + 100)
                }case 2:
                {
                        set_user_health(id, health + 500)
                }case 3:
                {
                        set_user_health(id, health + 1000)
                }
        }
        menu_destroy(menu)
        return PLUGIN_HANDLED
}


drekes 11-26-2011 20:50

Re: Help me to create Menu
 
@MyPc:

This is the scripting help section.
Here we help people develop their own plugin by giving them the info needed for it,
not give them complete codes.

MyPc 11-27-2011 00:03

Re: Help me to create Menu
 
Quote:

Originally Posted by drekes (Post 1603346)
@MyPc:

This is the scripting help section.
Here we help people develop their own plugin by giving them the info needed for it,
not give them complete codes.

ok sorry, wont do it next time.

made.tn 11-27-2011 03:21

Re: Help me to create Menu
 
thanks evry body


All times are GMT -4. The time now is 08:33.

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