Raised This Month: $ Target: $400
 0% 

[Solved] Help with menu errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 09-06-2014 , 13:02   [Solved] Help with menu errors
Reply With Quote #1

hey i am making a menu plugin for gungame server but it keeps giving me this error when compiling:

Quote:
/tmp/textRh8eUS.sma(34 -- 35) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(36) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(38 -- 39) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(40) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(42 -- 43) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(44) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(46 -- 47) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(48) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(50 -- 51) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(52) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(54 -- 55) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(56) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(58 -- 59) : error 029: invalid expression, assumed zero
/tmp/textRh8eUS.sma(60) : error 035: argument type mismatch (argument 1)
/tmp/textRh8eUS.sma(65) : warning 203: symbol is never used: "amx_gungame"
/tmp/textRh8eUS.sma(65) : warning 203: symbol is never used: "amx_gungame_restart"
/tmp/textRh8eUS.sma(65) : warning 203: symbol is never used: "amx_gungame_teamplay"
/tmp/textRh8eUS.sma(65) : warning 203: symbol is never used: "amx_gungame_vote"
/tmp/textRh8eUS.sma(65) : warning 203: symbol is never used: "amx_gungame_win"
here is the sma code :

Quote:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Gungame menu"
#define VERSION "1.0"
#define AUTHOR "Gelatina."

new amx_gungame
new amx_gungame_vote
new amx_gungame_restart
new amx_gungame_teamplay
new amx_gungame_win

public plugin_init()
{
register_clcmd( "amx_gungame_menu","GungameMenu" );
}
public GungameMenu ( id )
{
new menu = menu_create( "rGungame Menu:", "menu_handler" );
menu_additem( menu, "wGungame #1", "", ADMIN_MENU );
menu_additem( menu, "wSem Gungame #2", "", ADMIN_MENU );
menu_additem( menu, "wGungame vote #3", "", ADMIN_MENU );
menu_additem( menu, "wRestart #4", "", ADMIN_MENU );
menu_additem( menu, "wTeamplay #5", "", ADMIN_MENU );
menu_additem( menu, "wSem Teamplay #6", "", ADMIN_MENU );
menu_additem( menu, "wBest player win #7", "", ADMIN_MENU );
menu_display( id, menu, 0 );
}
public menu_handler( id, menu, item )
{
switch( item )
{
case 0
{
set_cvar_num( amx_gungame , 1 );
}
case 1
{
set_cvar_num( amx_gungame , 0 );
}
case 2
{
set_cvar_num( amx_gungame_vote , 1 );
}
case 3
{
set_cvar_num( amx_gungame_restart , 1 );
}
case 4
{
set_cvar_num( amx_gungame_teamplay , 1 );
}
case 5
{
set_cvar_num( amx_gungame_teamplay , 0 );
}
case 6
{
set_cvar_num( amx_gungame_win , 1 );
}
}
menu_destroy( menu );
return PLUGIN_HANDLED;
}
SOLVED
__________________

Last edited by andrept4; 09-07-2014 at 08:27. Reason: Solved
andrept4 is offline
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 09-06-2014 , 16:41   Re: Help with menu errors
Reply With Quote #2

You need to do the cases like "case 0: {}", instead of "case 0 {}". Also, you need to add quotation marks around the cvar names, like so:
PHP Code:
set_cvar_num("amx_gungame"1
This will solve the errors.
You don't need to add the "new cvarname" lines. This will solve the warnings.
__________________
~ Swiftly and with style ~

Last edited by EpicKiller; 09-06-2014 at 16:42.
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
Dark_Siders
Member
Join Date: Aug 2013
Location: Dreaming World
Old 09-06-2014 , 17:02   Re: Help with menu errors
Reply With Quote #3

And a suggestion: Instead of using set_cvar_num or get_cvar_num, use set_pcvar_num and get_pcvar_num(cvar pointers). This a better of way getting or setting cvar's value.
__________________
***********
I want to die peacefully in my sleep like my grandfather, not screaming in terror like his passengers.

***********

Last edited by Dark_Siders; 09-06-2014 at 17:06.
Dark_Siders is offline
Old 09-07-2014, 05:04
andrept4
This message has been deleted by andrept4.
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 09-07-2014 , 05:07   Re: Help with menu errors
Reply With Quote #4

Quote:
Originally Posted by EpicKiller View Post
You need to do the cases like "case 0: {}", instead of "case 0 {}". Also, you need to add quotation marks around the cvar names, like so:
PHP Code:
set_cvar_num("amx_gungame"1
This will solve the errors.
You don't need to add the "new cvarname" lines. This will solve the warnings.
thank you now the menu work! .. well the menu show's up but the cvars don't change anyway :/
__________________
andrept4 is offline
EpicKiller
Senior Member
Join Date: Jun 2014
Location: Constanta, Romania
Old 09-07-2014 , 05:38   Re: Help with menu errors
Reply With Quote #5

Quote:
Originally Posted by andrept4 View Post
thank you now the menu work! .. well the menu show's up but the cvars don't change anyway :/
Well, I don't really know if it will work, but you could try something like this:
PHP Code:
#include <amxmodx>

new pCvar_gg;

public 
plugin_init()
{
    
register_plugin("""""");
    
    
register_clcmd("say /whatever""cmdWhatever");
}

public 
cmdWhatever(id)
{
    new 
menu menu_create("Menu""menu_handler");
    
menu_additem(menu"#1"""0);
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
menu_handler(idmenuitem)
{
    if(
item == MENU_EXIT)
        
menu_destroy(menu);
    
    switch(
item)
    {
        case 
0:
        {
            
pCvar_gg get_cvar_pointer("amx_gungame");
            
set_pcvar_num(pCvar_gg1);
        }
    }
    
menu_destroy(menu);
    
    return 
PLUGIN_HANDLED;

__________________
~ Swiftly and with style ~

Last edited by EpicKiller; 09-07-2014 at 05:41.
EpicKiller is offline
Send a message via Yahoo to EpicKiller Send a message via Skype™ to EpicKiller
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 09-07-2014 , 05:51   Re: Help with menu errors
Reply With Quote #6

wait, can't i make a admin console command to change the cvar ? like this : console_cmd(id, "cvar", "value"); ?
__________________
andrept4 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-07-2014 , 05:53   Re: Help with menu errors
Reply With Quote #7

Code:
set_pcvar_num( get_cvar_pointer( "cvar" ),  value)

Why you would need to make a custom command when you have amx_cvar ?
__________________
HamletEagle is offline
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 09-07-2014 , 05:54   Re: Help with menu errors
Reply With Quote #8

Quote:
Originally Posted by HamletEagle View Post
Code:
set_pcvar_num( get_cvar_pointer( "cvar" ), value)
L 09/07/2014 - 10:57:58: Invalid CVAR pointer
L 09/07/2014 - 10:57:58: [AMXX] Run time error 10 (plugin "lll.amxx") (native "set_pcvar_num") - debug not enabled!

Quote:
Originally Posted by HamletEagle View Post
Why you would need to make a custom command when you have amx_cvar ?
That's a good idea thank you !
__________________

Last edited by andrept4; 09-07-2014 at 06:03.
andrept4 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 09-07-2014 , 06:03   Re: Help with menu errors
Reply With Quote #9

Lol, replace cvar with what you need and add debug after the plugin name so we can know what's producing the error.
__________________

Last edited by HamletEagle; 09-07-2014 at 06:03.
HamletEagle is offline
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 09-07-2014 , 06:09   Re: Help with menu errors
Reply With Quote #10

maybe:
PHP Code:

set_pcvar_num
get_cvar_pointer"cvar" ),  value
to

PHP Code:

set_pcvar_num
get_cvar_pointer"cvar" ),  value); 
__________________
andrept4 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:26.


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