Raised This Month: $12 Target: $400
 3% 

errors at compiling a menu plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
makavelli
Senior Member
Join Date: Nov 2006
Location: Belgium
Old 01-15-2012 , 08:44   errors at compiling a menu plugin
Reply With Quote #1

hey
I tryed to compile a menu plugin to ad a menu when a player types /jb
but it gave 4 errors on line 15

"Error: Expected token: ",", but found "-string-" on line 15"
"Warning: Expression has no effect on line 15"
"Error: Expected token: ";", but found ")" on line 15"
"Error: Invalid expression, assumed zero on line 15"
this is what i have in "public plugin_init()"

PHP Code:
 public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("/jb" "JB menu"); //<--- This is line 15

Can anyone help me?
this is the full script, followed the tutorial from EMP'

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "/jbmenu-scripttest"
#define VERSION "1.0"
#define AUTHOR "makavelli"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("/jb" "JB menu");
}
public 
JB_menu(id)
{
    new 
menu menu_create("\rJailbreak Menu""menu_handler")
    
    
menu_additem(menu"\ymystats #1""1""0");
    
menu_additem(menu"\wtestmenu #2""2""0");
    
menu_additem(menu"\bbluemenuselec""3""0");
    
menu_additem(menu"\oAdminmenu""4"Admin_admin);
  
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
  
    
menu_display(idmenu0);
}    

public 
menu_handler(idmenuitem)
{    
 
    if( 
item == MENU_EXIT )    
    {
        
menu_destroy(menu);
      
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], szName[64];
    new 
accesscallback;

    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    new 
key str_to_num(data);
    
type of string you want)

    switch(
key)
    {
    case 
1:
        {    
            
client_print(idprint_chat"You are now viewing you'r rank");
           
            
menu_destroy(menu);
        
//how can I make it so if the players presses this button his /rankstats shows up?
            
return PLUGIN_HANDLED;
        }
    case 
2:
        {
            
client_print(idprint_chat"blabla");
        }
        case 
3
        {
            
client_print(idprint_chat"blablainblue?");
        }
     case 
4//again i don't have experience with the admin limitations, so i don't know if you need to have a check before this (im assuming you don't though ^_^)
        
{
            
client_print(idprint_chat"You have selected the Awesome Admin Selection! Hail Teh Bail!");
        
//with this option I want the plugincvarmenu to show up (like adlin woulkd say amx_plugincvarmenu) how can I do this?
    
}
    }

menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 }


Last edited by makavelli; 01-15-2012 at 09:11.
makavelli is offline
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 01-15-2012 , 10:40   Re: errors at compiling a menu plugin
Reply With Quote #2

Code:
register_clcmd("/jb" "JB menu");
=>
Code:
register_clcmd("/jb","JB_menu");
__________________

Last edited by kramesa; 01-15-2012 at 10:40.
kramesa is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 01-15-2012 , 11:49   Re: errors at compiling a menu plugin
Reply With Quote #3

Reading your code, all you need ->

client_cmd - http://www.amxmodx.org/funcwiki.php?go=func&id=230
get_user_flags - http://www.amxmodx.org/doc/index.htm...user_flags.htm

I think you can start with this and then learn - http://forums.alliedmods.net/showthread.php?t=41251

Last edited by fireattack; 01-15-2012 at 11:50.
fireattack is offline
makavelli
Senior Member
Join Date: Nov 2006
Location: Belgium
Old 01-15-2012 , 13:05   Re: errors at compiling a menu plugin
Reply With Quote #4

thx alot u both

fireattack: what do i have to type in index, string, float? so if he presses the switch key he automaticly sais /rankstats so that his stats show up?

client_cmd ( index, const command[], {Float,...} )
client_cmd (id, client_chat, /rankstats); ? or something else

and to check the flags for admin when he wants to enter admin menu?
get_user_flags ( index,id=0 )
get_user_flags (authid,id=0)? or maybe get_user_flags (ADMIN_KICK,id=0)
PHP Code:
case 4:
       {
            
client_print(idprint_chat"You have selected the Awesome Admin Selection! Hail Teh Bail!");
         
get_user_flags index,id=)
       } 
Btw; what does this error mean? (indentation)
Warning: Loose indentation on line 96

Last edited by makavelli; 01-15-2012 at 13:34.
makavelli is offline
fireattack
Senior Member
Join Date: Jul 2008
Old 01-15-2012 , 13:33   Re: errors at compiling a menu plugin
Reply With Quote #5

Index is the "player" who opened the menu, for example:

client_cmd( id, "say /rank" ); Otherwise this can be considered as slowhacking which isn't allowed here because you're forcing a player to do a thing withouth his permission refering to client side. So the correct way is using natives.

get_user_flags( id ) & ADMIN_KICK Search this on AM and you'll find everything you need.

Last edited by fireattack; 01-15-2012 at 14:02.
fireattack is offline
makavelli
Senior Member
Join Date: Nov 2006
Location: Belgium
Old 01-15-2012 , 13:57   Re: errors at compiling a menu plugin
Reply With Quote #6

Quote:
Originally Posted by fireattack View Post
Index if the "player" who opened the menu, for example:

client_cmd( id, "say /rank" ); Otherwise this can be considered as slowhacking which isn't allowed here because you're forcing a player to do a thing withouth his permission refering to client side. So the correct way is using natives.
what do you mean? what is the index then? and "say /rankstats) is the float right?
makavelli is offline
makavelli
Senior Member
Join Date: Nov 2006
Location: Belgium
Old 01-16-2012 , 10:36   Re: errors at compiling a menu plugin
Reply With Quote #7

wow I cant believe i asked that stopit question you already gave me the answer :$ sorry.
thx alot fireattack
makavelli is offline
Old 01-16-2012, 11:11
makavelli
This message has been deleted by makavelli. Reason: problem found
makavelli
Senior Member
Join Date: Nov 2006
Location: Belgium
Old 01-16-2012 , 11:40   Re: errors at compiling a menu plugin
Reply With Quote #8

Does anyone know the colors you can use in a menu?
I know red and yellow are \r and \y are there any others?
makavelli is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-16-2012 , 15:45   Re: errors at compiling a menu plugin
Reply With Quote #9

https://forums.alliedmods.net/showth...46364#EndNotes
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
makavelli
Senior Member
Join Date: Nov 2006
Location: Belgium
Old 01-17-2012 , 10:00   Re: errors at compiling a menu plugin
Reply With Quote #10

right, thank you
makavelli is offline
Reply


Thread Tools
Display Modes

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 17:24.


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