AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   again a menu problem (https://forums.alliedmods.net/showthread.php?t=118245)

One 02-09-2010 03:41

again a menu problem
 
PHP Code:

public show_help_menu(id)
{
    new 
menuheader[32]
    new 
name[33]
    
get_user_name(id,name,32)
    
formatex(menuheader31"\yHello %s,^nHow can i help you?"name)
    new 
menu menu_create(menuheader"help_functions")
    if(
get_pcvar_num(g_freeday_manager))
    {
        
menu_additem(menu,"\wFreeday manager menu","1","0")
        
menu_additem(menu,"\wGlow menu","2","0")
        
/*menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")*/
    
}
    else
    {
        
menu_additem(menu,"\wGlow menu","1","0")
        
menu_additem(menu,"\wtest","2","0")
        
/*menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")*/
    
}
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}
public 
help_functions(id,item,menu)
{
    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)
    {
        if(
get_pcvar_num(g_freeday_manager))
        {
            case 
1:
            {
                
//case 1
            
}
        }
        else
        {
            case 
1:
            {
                
// case 1
            
}
        }
    }
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


Errors :

PHP Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c1997-2006 ITB CompuPhaseAMX Mod X Team

Error
Argument type mismatch (argument 4on line 58
Error
Argument type mismatch (argument 4on line 59
Error
Argument type mismatch (argument 4on line 73
Error
Argument type mismatch (argument 4on line 74
Error
Only a single statement (or expressioncan follow each "case" on line 102
Error
Invalid subscript (not an array or too many subscripts): "get_pcvar_num" on line 102
Error
Expected token"}"but found "case" on line 102
Error
Too many error messages on one line on line 102

Compilation aborted
.
8 Errors.
Could not locate output file C:\Programme\Steam\steamapps\cpl_one\counter-strike\cstrike\addons\amxmodx\plugins\Untitled.amx (compile failed). 

WTF?

Flipper_SPb 02-09-2010 04:20

Re: again a menu problem
 
Hm... Can you show whole code?

One 02-09-2010 04:22

Re: again a menu problem
 
sorry i can't show more :P

PHP Code:

new g_freeday_manager

g_freeday_manager 
register_cvar("amx_freeday_manager","1")
register_forward(FM_Touch"client_touch")


public 
client_touch(ent,id)
{
    if(!
is_user_alive(id))
    {
        return 
FMRES_IGNORED
    
}
    new 
classname[32]
    
pev(entpev_classnameclassname31)
    
    if(
equali(classname"shacks_Director"))
    {        
        
show_help_menu(id)
    }
    return 
FMRES_IGNORED
}

public 
show_help_menu(id)
{
    new 
menuheader[32]
    new 
name[33]
    
get_user_name(id,name,32)
    
formatex(menuheader31"\yHello %s,^nHow can i help you?"name)
    new 
menu menu_create(menuheader"help_functions")
    if(
get_pcvar_num(g_freeday_manager))
    {
        
menu_additem(menu,"\wFreeday manager menu","1","0")
        
menu_additem(menu,"\wGlow menu","2","0")
        
/*menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")*/
    
}
    else
    {
        
menu_additem(menu,"\wGlow menu","1","0")
        
menu_additem(menu,"\wtest","2","0")
        
/*menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")
        menu_additem(menu,"\w","1","0")*/
    
}
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)



Arkshine 02-09-2010 06:59

Re: again a menu problem
 
Both errors are really very easy to fix. It doesn't need knowledge, just some common sense and some thoughts. ( yes basically you have to use your brain )

- http://www.amxmodx.org/funcwiki.php?...item&go=search ; is that hard to search how works the function and to compare if the arguments are right ?
- With all those plugins which use switch() I'm wondering how you can think it will work this way.

One 02-09-2010 08:03

Re: again a menu problem
 
hihi. sry i was @ uni and could'nt find where i am wrong :P its now done. ty & sry :P


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

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