AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   errors at compiling a menu plugin (https://forums.alliedmods.net/showthread.php?t=176229)

makavelli 01-15-2012 08:44

errors at compiling a menu plugin
 
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;
 }



kramesa 01-15-2012 10:40

Re: errors at compiling a menu plugin
 
Code:
register_clcmd("/jb" "JB menu");
=>
Code:
register_clcmd("/jb","JB_menu");

fireattack 01-15-2012 11:49

Re: errors at compiling a menu plugin
 
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

makavelli 01-15-2012 13:05

Re: errors at compiling a menu plugin
 
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

fireattack 01-15-2012 13:33

Re: errors at compiling a menu plugin
 
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.

makavelli 01-15-2012 13:57

Re: errors at compiling a menu plugin
 
Quote:

Originally Posted by fireattack (Post 1632385)
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 01-16-2012 10:36

Re: errors at compiling a menu plugin
 
wow I cant believe i asked that stopit question you already gave me the answer :$ sorry.
thx alot fireattack

makavelli 01-16-2012 11:40

Re: errors at compiling a menu plugin
 
Does anyone know the colors you can use in a menu?
I know red and yellow are \r and \y are there any others?

Emp` 01-16-2012 15:45

Re: errors at compiling a menu plugin
 
https://forums.alliedmods.net/showth...46364#EndNotes

makavelli 01-17-2012 10:00

Re: errors at compiling a menu plugin
 
Quote:

Originally Posted by Emp` (Post 1633043)

right, thank you :)


All times are GMT -4. The time now is 12:11.

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