AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   New AMXX Menu System (https://forums.alliedmods.net/showthread.php?t=46364)

AntiBots 04-05-2009 18:20

Re: New AMXX Menu System
 
Quote:

Originally Posted by fysiks (Post 798332)
I tried to pass a long string (long -> >6 charaters) and it didn't work. It seems I'm limited to data[6] :(. Is this correct?

I was trying to avoid using newplayername[33][32] to pass the new name through to the handler.

Show your code. you can pass more big information.

Example
PHP Code:

menu_additem(mymenu"LALIN""HEREALLMYDATA")

[...]

static 
Data[64]
menu_item_getinfo(menuitem_Data63)

server_print(Data)  --> HEREALLMYDATA 


fysiks 04-05-2009 18:25

Re: New AMXX Menu System
 
Oops, I changed the dim on data but forgot to change "len" in menu_item_getinfo :) my bad.

faiLL 04-06-2009 09:36

Re: New AMXX Menu System
 
Very big THANKS to Emp` good job ;)

Emp` 04-11-2009 05:11

Re: New AMXX Menu System
 
Added vote menu example, sub-menu example, and end notes to the main post.

edit: Added advance vote menu example.

fysiks 04-11-2009 07:57

Re: New AMXX Menu System
 
So, you say to store as a global if it's a unchanging menu. Do I create the menu in plugin_init? Also, should I ever call menu_destroy() within the plugin? I read that there was "memory leaking" when you don't destroy a menu.

TitANious 04-11-2009 08:30

Re: New AMXX Menu System
 
This can be a example of a menu
PHP Code:

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

public plugin_init() {  
    
register_plugin(PLUGINVERSIONAUTHOR)  
    
register_clcmd("say /Scoutmenu","cmdScoutKnifeZMenu") , 
    
register_clcmd("say_team /Scoutmenu","cmdScoutKnifeZMenu")  
     


public 
cmdScoutKnifeZMenuid ) { 
        return; 
     
    new 
menu menu_create ("\rMenu for ScoutKnifeZ_Manager!:""handleScoutKnifeZMenu")  
    
menu_additem(menu"\wGravity800""1"0)  
    
menu_additem(menu"\wGravity600""2"0)  
    
menu_additem(menu"\wGravity400""3"0)  
    
menu_additem(menu"\wGravity200""4"0)  
    
menu_additem(menu"\wGravity100""5"0)  
    
menu_additem(menu"\wGiveSg550""6"0)  
    
menu_additem(menu"\wGiveAWP""7"0)  
    
menu_additem(menu"\wGiveG3sg1""8"0)  
    
menu_display(idmenu0)  
}  

public 
handleScoutKnifeZMenu(idmenuitem)  { 
    if (
item == MENU_EXIT)  
    {  
        
menu_destroy(menu)  
        return 
PLUGIN_HANDLED  
    
}  
    new 
data[6], iName[64]  
    new 
accesscallback  
     
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)  
    new 
key str_to_num(data)  
     
    switch( 
key
    { 
        case 
1:  
        {  
                
set_user_gravity(id1.0)  
                
client_print(idprint_chat"You have 800 gravity isnt that normal?"
            } 
        }  
        case 
2:  
        { 
                
set_user_gravity(id0.75)  
                
client_print(idprint_chat"600 gravity, a bit less than 800, nothing less?")  
            } 
        }  
        case 
3:  
        {  
                
set_user_gravity(id0.5)  
                
client_print(idprint_chat"400, the half of normal!")  
            } 
        }  
        case 
4:  
        {  
                
set_user_gravity(id0.25)  
                
client_print(idprint_chat"200, the half of 400, you jump high now"
            } 
        }  
        case 
5:  
        {  
                
set_user_gravity(id0.125)  
                
client_print(idprint_chat"100, the less in the whole server!")  
            } 
        }  
        case 
6:  
        {  
                
client_cmd(id"slot1; drop")  
                
give_itemid"weapon_sg550" 
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
give_itemid"ammo_556nato")  
                
client_print(idprint_chat"Didnt i deleted SG550?!")  
            } 
        }  
        case 
7:  
        {  
                
client_cmd(id"slot1; drop")  
                
give_itemid"weapon_awp" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
give_itemid"ammo_338magnum" )  
                
client_print(idprint_chat"Isnt a AWP forbidden?!")  
            } 
        }  
        case 
8:  
        {  
                
client_cmd(id"slot1; drop")  
                
give_item(id"weapon_g3sg1" )  
                
give_item(id"ammo_762nato")  
                
give_item(id"ammo_762nato")  
                
give_item(id"ammo_762nato")  
                
give_item(id"ammo_762nato")  
                
give_item(id"ammo_762nato")  
                
give_item(id"ammo_762nato")  
                
client_print(idprint_chat"Did you really buy a G3SG1?!")  
            } 
        }  
    }  
     
    
menu_destroy(menu)  
    return 
PLUGIN_HANDLED  


I think i have to many #includes :P, but this is a menu

chungkiman 04-23-2009 21:01

Re: New AMXX Menu System
 
i wanna to ask, how to make a menu like this

http://2uploadhk.com/view/16105/2008...sruAwxYPxv.png

in which you can on\off the menu option

關 = off the function

thank you

fysiks 04-23-2009 22:58

Re: New AMXX Menu System
 
Depends on what the menu option does. (Most of use can't read that btw).

chungkiman 04-24-2009 02:18

Re: New AMXX Menu System
 
for example, if i want to adjust the volume of the mic
in the menu, there is a option like that

Volume of Mic 100\50\10\0

you can choose the volume by the way you want.

how to do it - -?

hnorgist 04-25-2009 19:16

Re: New AMXX Menu System
 
Can't understand if it is possible to destroy menu hud by plugin. When vote stops by timer (some player didn't vote and still have menu on screen), killing the menu doesn't clean player's hud.. Is it really impossible to do?.. description says so:
Code:

/**
 * Destroys a menu.  Player menus will be cancelled (although may still linger on the HUD), and future attempts to access the menu resource will result in an error.
...
 */
native menu_destroy(menu);



All times are GMT -4. The time now is 01:56.

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