AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help, wiith menu? (https://forums.alliedmods.net/showthread.php?t=183250)

Bilal Pro 04-19-2012 15:25

Help, wiith menu?
 
Hello people,

How can i set for example this is a menu:

PHP Code:

Ban Menu:
1. Test1 (player)
2. Test2 (player)
3. Test3 (Player)

4. Choose length to ban5 minutes 

For example i want that when i press 4 it goes to 10 minutes, and so on how can i set that?

Exolent[jNr] 04-19-2012 15:32

Re: Help, wiith menu?
 
Look in AMX Mod X's plmenu.sma plugin.

Bilal Pro 04-19-2012 16:07

Re: Help, wiith menu?
 
This .sma looks wicked :S

Like, this is made on a professional level. And im on a LOW level :P

rak 04-19-2012 20:07

Re: Help, wiith menu?
 
Quote:

Originally Posted by Bilal Pro (Post 1692496)
Hello people,

How can i set for example this is a menu:

PHP Code:

Ban Menu:
1. Test1 (player)
2. Test2 (player)
3. Test3 (Player)

4. Choose length to ban5 minutes 

For example i want that when i press 4 it goes to 10 minutes, and so on how can i set that?

i kill my head for few hours and i have this :P

Credits: Shinoda for help me in some stuff

PHP Code:

#include <amxmodx>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"

new const VALUE_LIFE[][] = {
    
"1",
    
"50",
    
"100",
    
"250"
}

new const 
MENU_OPTION[] = "Option"

new g_life_key[33], Menu_Item_Option[32]


public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say test""cmdSay")
}

public 
cmdSay(id) {
    
Menu_Life(id0)
    return 
PLUGIN_HANDLED
}

public 
Menu_Life(idpage) {
    
    new 
Player_Id[3], Name[32], TempidPlayer_NumPlayers[32]
    new 
Menu menu_create("Add Life Menu""menu_handler")
    
    
formatex(Menu_Item_Optioncharsmax(Menu_Item_Option), "Life: %s"VALUE_LIFE[g_life_key[id]])
    
    
get_players(PlayersPlayer_Num)
    
    for(new 
iPlayer_Numi++) {
        
        if(
&& !(6))
            
menu_additem(MenuMenu_Item_OptionMENU_OPTION)
        
        
Tempid Players[i]
        
        
get_user_name(TempidNamecharsmax(Name))
        
num_to_str(TempidPlayer_Idcharsmax(Player_Id))
        
        
menu_additem(MenuNamePlayer_Id)        
    }
    
    
menu_additem(MenuMenu_Item_OptionMENU_OPTION)
    
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
    
menu_display(idMenupage)
}

public 
menu_handler(idmenuitem) {
    
    if(
item == MENU_EXIT || !is_user_connected(id)) {
        
menu_destroy(menu)
        return
    }
    
    new 
iKey[7], iAccessiCallbackiName[32]
    
    
menu_item_getinfo(menuitemiAccessiKeycharsmax(iKey), iNamecharsmax(iName), iCallback)
    
    if(
equal(iKeyMENU_OPTION)) {
        if(
g_life_key[id] < sizeof VALUE_LIFE -1)
            
g_life_key[id]++
        else
            
g_life_key[id] = 0
        
        
new pagenewmenuoldmenu
        player_menu_info
(idoldmenunewmenupage)
        
        
Menu_Life(idpage)
        
menu_destroy(menu)
        return
    }
        
    new 
tempid str_to_num(iKey)
    new 
life str_to_num(VALUE_LIFE[g_life_key[id]])
    
set_user_health(tempidlife)


this is a menu to give life

fysiks 04-19-2012 22:11

Re: Help, wiith menu?
 
What you see in plmenu.sma is the most efficient method. It just takes patience and time testing things to figure it out.


All times are GMT -4. The time now is 07:53.

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