AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What's wrong (https://forums.alliedmods.net/showthread.php?t=107267)

Redfalcon 10-24-2009 18:07

What's wrong
 
What's wrong with this code?
PHP Code:

register_clcmd("say /xp""XpMenu");
 public 
XpMenu(id) {
 new 
menu menu_create("\Xpmod menu""xpmenu_handler");
 
menu_additem(menu"\Info""7"0);
 
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
 public 
xpmenu_handler(idmenuitem) { 


alan_el_more 10-24-2009 18:10

Re: What's wrong
 
Post in php codes
PHP Code:

public XpMenu(id)
{
   new 
menu menu_create("\Xpmod menu""xpmenu_handler");
   
menu_additem(menu"\Info""7"0);
   
menu_setprop(menuMPROP_EXITMEXIT_ALL);
   
menu_display(idmenu0);


You forgot to close the function

Redfalcon 10-24-2009 18:18

Re: What's wrong
 
PHP Code:

public plugin_init() {
register_clcmd("say /xp""XpMenu");
}
public 
XpMenu(id) {
    new 
menu menu_create("\Xpmod menu""xpmenu_handler");
    
menu_additem(menu"\Info""7"0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}
public 
xpmenu_handler(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 
7:
        {
            
client_print(idprint_chat"You pressed for info  ")
        }
    }
    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;


The menu doesn't show up.
I skipped registering and includes.


All times are GMT -4. The time now is 17:39.

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