AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Doesnt compile (https://forums.alliedmods.net/showthread.php?t=241271)

nixh 05-31-2014 13:43

Doesnt compile
 
Hey forum members, got this thing and it doesnt compile can you help me fix this problem? :stupid:


Code:

#include <amxmodx>


new g_szTitle[] = "JailBreak Menu";
 
public plugin_init()
{

            register_plugin("JbMenu", "1.1", "whocares");
            register_clcmd( "chooseteam" , "ShowMenu" );
       
       
   
     
}
public ShowMenu(id)
{
     
        new iNum
       
        new iMinutes
       
        new CurrentMap[33]
       
        new szMenuTitle[150]
       
        iMinutes = get_timeleft( ) / 60
        // gets the amount of players on server and saves it into iNum
        iNum = get_playersnum( )
       
        get_mapname(CurrentMap, charsmax(CurrentMap));
       
        formatex(szMenuTitle, charsmax(szMenuTitle), "\r\y%s^n\rCurrent Map:\w%s^n\w%d \yPlayers Online\r| \w%d \yMinutes left\r| \yYou have \w%i$\yJbCash",g_szTitle, CurrentMap, iNum, iMinutes);
        new menu = menu_create(szMenuTitle, "Jb_Menu");
       
       
        menu_additem(menu, "VIP Menu", "", 0); // case 0
        menu_additem(menu, "JbShop", "", 0); // case 1
        menu_additem(menu, "Achievements", "", 0); // case 2
        menu_additem(menu, "Playtime", "", 0); // case 3
        menu_additem(menu, "CashTop", "", 0); // case 4
        menu_additem(menu, "Rules", "", 0); // case 5
        menu_additem(menu, "Change Team", "", 0); // case 6
       
 
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
 
        menu_display(id, menu, 0);
 
        return PLUGIN_HANDLED;
}
public Jb_Menu(id, menu, item)
{
        if(item == MENU_EXIT)
        {
                menu_cancel(id);
                return PLUGIN_HANDLED;
        }
 
        new command[6], name[64], access, callback;
 
        menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
 
        switch(item)
        {
                case 0:
                {
                        client_cmd(id, "say /menu")
                        client_print(id, print_chat, "You have selected the VIP Menu");
                }
                case 1:
                {
                        client_cmd(id, "say /jbshop")
                        client_print(id, print_chat, "You have selected The JailBreakShop");
                }
                case 2:
                {
                        client_cmd(id, "say /ac")
                        client_print(id, print_chat, "You have selected The Achievements Menu");
                }
                case 3:
                {
                        client_cmd(id, "say /playtime")
                        client_print(id, print_chat, "You have selected Playtime Menu");
                }
                case 4:
                {
                        client_cmd(id, "say /cashtop")
                        client_print(id, print_chat, "You have selected Cashtop");
                }
                case 5:
                {
                        client_cmd(id, "say /rules")
                        client_print(id, print_chat, "You have selected Rules");
                }
          case 6:
          {
          show_menu_team(id)
          }
        }
 
        menu_destroy(menu);
 
        return PLUGIN_HANDLED;
}


Flick3rR 05-31-2014 13:46

Re: Doesnt compile
 
The compiler says it itself - Undefined symbol "show_menu_team". Looks like you haven't put that function anywhere in your code and the compiler can't find it.

nixh 05-31-2014 13:57

Re: Doesnt compile
 
so i need to remove this?
show_menu_team(id)

Flick3rR 05-31-2014 14:04

Re: Doesnt compile
 
It all depend of what are you trying to do? I can see this is not the whole code. You can share the whole, so we can see it and help you. Otherwise remove that sixth function from the menu and make it with only 5. But as I can see, the sixth function is a team choose. So you can easily hook client_cmd chooseteam and make the player choose a team.

nixh 05-31-2014 14:10

Re: Doesnt compile
 
Idk its the whole code i think i took it from https://forums.alliedmods.net/showthread.php?t=228667, or maybie you could code something like this? it would be helpfull.

Freezo Begin 05-31-2014 14:20

Re: Doesnt compile
 
PHP Code:

#include <amxmodx>
#include <cstrike>

new g_szTitle[] = "JailBreak Menu";

public 
plugin_init()
{
    
register_plugin("JbMenu""1.1""whocares");
    
register_clcmd"chooseteam" "ShowMenu" );
}
public 
ShowMenu(id)
{
    
    new 
iNum,CurrentMap[33],szMenuTitle[150]
    
    new 
iMinutes get_timeleft( ) / 60
    iNum 
get_playersnum( )
    
    
get_mapname(CurrentMapcharsmax(CurrentMap));
    
    
formatex(szMenuTitlecharsmax(szMenuTitle), "\r\y%s^n\rCurrent Map:\w%s^n\w%d \yPlayers Online\r| \w%d \yMinutes left\r| \yYou have \w%i$\yJbCash",g_szTitleCurrentMapiNumiMinutes);
    new 
menu menu_create(szMenuTitle"Jb_Menu");
    
    
    
menu_additem(menu"VIP Menu"""0); // case 0
    
menu_additem(menu"JbShop"""0); // case 1
    
menu_additem(menu"Achievements"""0); // case 2
    
menu_additem(menu"Playtime"""0); // case 3
    
menu_additem(menu"CashTop"""0); // case 4
    
menu_additem(menu"Rules"""0); // case 5
    
menu_additem(menu"Change Team"""0); // case 6
    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}
public 
Jb_Menu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
command[6], name[64], accesscallback;
    
    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);
    
    switch(
item)
    {
        case 
0:
        {
            
client_cmd(id"say /menu")
            
client_print(idprint_chat"You have selected the VIP Menu");
        }
        case 
1:
        {
            
client_cmd(id"say /jbshop")
            
client_print(idprint_chat"You have selected The JailBreakShop");
        }
        case 
2:
        {
            
client_cmd(id"say /ac")
            
client_print(idprint_chat"You have selected The Achievements Menu");
        }
        case 
3:
        {
            
client_cmd(id"say /playtime")
            
client_print(idprint_chat"You have selected Playtime Menu");
        }
        case 
4:
        {
            
client_cmd(id"say /cashtop")
            
client_print(idprint_chat"You have selected Cashtop");
        }
        case 
5:
        {
            
client_cmd(id"say /rules")
            
client_print(idprint_chat"You have selected Rules");
        }
        case 
6:
        {
            
show_menu_team(id)
        }
    }
    
    
menu_destroy(menu);
    
    return 
PLUGIN_HANDLED;
}
public 
show_menu_team(id)
{
    
    new 
Menu menu_create("\yTeam menu""Main")
    
    
menu_additem(Menu"Go To Ct""1"0)
    
menu_additem(Menu"Go to Terro""2"0)
    
menu_additem(Menu"Go to Spec""3"0)
    
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL );
    
menu_setprop(MenuMPROP_EXITNAME"\dClose" )
    
menu_setprop(MenuMPROP_NUMBER_COLOR"\r" )
    
menu_display(idMenu0)
    
}

public 
Main(idMenuitem)
{      
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(Menuitemaccessdata6iName63callback)
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if (
cs_get_user_team(id) == CS_TEAM_CT)
            {
                
client_print(id,print_chat,"You are already Ct")
            }
            else
            {
                
cs_set_user_team(id,CS_TEAM_CT)    
            }
        }
        case 
2:
        {
            if (
cs_get_user_team(id) == CS_TEAM_T)
            {
                
client_print(id,print_chat,"You are already Terro")
            }
            else
            {
                
cs_set_user_team(id,CS_TEAM_T)    
            }
        }
        case 
3:
        {
            if (
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
            {
                
client_print(id,print_chat,"You are already Spec")
            }
            else
            {
                
cs_set_user_team(id,CS_TEAM_SPECTATOR)    
            }
        }
    }
    
menu_destroy(Menu);
    return 
PLUGIN_HANDLED;



Fuck For Fun 05-31-2014 14:23

Re: Doesnt compile
 
Check:
Code:

/* Plugin generated by AMXX-Studio */

#include < amxmodx >

new g_szTitle[] = "JailBreak Menu";
 
public plugin_init()
{
    register_plugin("JbMenu", "1.1", "whocares");
    register_clcmd( "chooseteam" , "ShowMenu" );
}

public ShowMenu(id)
{
    if ( !is_user_connected( id ) )
        return 1;

    new iNum,iMinutes,CurrentMap[33]
    new szMenuTitle[150]
       
    iMinutes = get_timeleft( ) / 60
        // gets the amount of players on server and saves it into iNum
    iNum = get_playersnum( )
       
    get_mapname(CurrentMap, charsmax(CurrentMap));
       
    formatex(szMenuTitle, charsmax(szMenuTitle), "\r\y%s^n\rCurrent Map:\w%s^n\w%d \yPlayers Online\r| \w%d \yMinutes left\r| \yYou have \w%i$\yJbCash",g_szTitle, CurrentMap, iNum, iMinutes);
    new menu = menu_create(szMenuTitle, "Jb_Menu");
       
       
    menu_additem(menu, "VIP Menu", "", 0); // case 0
    menu_additem(menu, "JbShop", "", 0); // case 1
    menu_additem(menu, "Achievements", "", 0); // case 2
    menu_additem(menu, "Playtime", "", 0); // case 3
    menu_additem(menu, "CashTop", "", 0); // case 4
    menu_additem(menu, "Rules", "", 0); // case 5
    menu_additem(menu, "Change Team", "", 0); // case 6
 
    menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
    menu_display(id, menu, 0);

    return PLUGIN_HANDLED;
}

public Jb_Menu(id, menu, item)
{
        if(item == MENU_EXIT)
        {
                menu_cancel(id);
                return PLUGIN_HANDLED;
        }
 
        new command[6], name[64], access, callback;
 
        menu_item_getinfo(menu, item, access, command, sizeof command - 1, name, sizeof name - 1, callback);
 
        switch(item)
        {
                case 0:
                {
            client_cmd(id, "say /menu")
            client_print(id, print_chat, "You have selected the VIP Menu");
                }
                case 1:
                {
            client_cmd(id, "say /jbshop")
            client_print(id, print_chat, "You have selected The JailBreakShop");
                }
                case 2:
                {
            client_cmd(id, "say /ac")
            client_print(id, print_chat, "You have selected The Achievements Menu");
                }
                case 3:
                {
            client_cmd(id, "say /playtime")
            client_print(id, print_chat, "You have selected Playtime Menu");
                }
                case 4:
                {
            client_cmd(id, "say /cashtop")
            client_print(id, print_chat, "You have selected Cashtop");
                }
                case 5:
                {
            client_cmd(id, "say /rules")
            client_print(id, print_chat, "You have selected Rules");
                }
          case 6:
          {
            // public of your menu changeteam
                }
    }
    menu_destroy(menu);
   
    return PLUGIN_HANDLED;
}


Spawner30 05-31-2014 14:28

Re: Doesnt compile
 
if this plugin for JB better to switch 2 team Terro + Spec
PHP Code:

#include <amxmodx>
#include <cstrike>

new g_szTitle[] = "JailBreak Menu";

public 
plugin_init()
{
    
register_plugin("JbMenu""1.1""whocares");
    
register_clcmd"chooseteam" "ShowMenu" );
}
public 
ShowMenu(id)
{
    
    new 
iNum,CurrentMap[33],szMenuTitle[150]
    
    new 
iMinutes get_timeleft( ) / 60
    iNum 
get_playersnum( )
    
    
get_mapname(CurrentMapcharsmax(CurrentMap));
    
    
formatex(szMenuTitlecharsmax(szMenuTitle), "\r\y%s^n\rCurrent Map:\w%s^n\w%d \yPlayers Online\r| \w%d \yMinutes left\r| \yYou have \w%i$\yJbCash",g_szTitleCurrentMapiNumiMinutes);
    new 
menu menu_create(szMenuTitle"Jb_Menu");
    
    
    
menu_additem(menu"VIP Menu"""0); // case 0
    
menu_additem(menu"JbShop"""0); // case 1
    
menu_additem(menu"Achievements"""0); // case 2
    
menu_additem(menu"Playtime"""0); // case 3
    
menu_additem(menu"CashTop"""0); // case 4
    
menu_additem(menu"Rules"""0); // case 5
    
menu_additem(menu"Change Team"""0); // case 6
    
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
    
menu_display(idmenu0);
    
    return 
PLUGIN_HANDLED;
}
public 
Jb_Menu(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_cancel(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
command[6], name[64], accesscallback;
    
    
menu_item_getinfo(menuitemaccesscommandsizeof command 1namesizeof name 1callback);
    
    switch(
item)
    {
        case 
0:
        {
            
client_cmd(id"say /menu")
            
client_print(idprint_chat"You have selected the VIP Menu");
        }
        case 
1:
        {
            
client_cmd(id"say /jbshop")
            
client_print(idprint_chat"You have selected The JailBreakShop");
        }
        case 
2:
        {
            
client_cmd(id"say /ac")
            
client_print(idprint_chat"You have selected The Achievements Menu");
        }
        case 
3:
        {
            
client_cmd(id"say /playtime")
            
client_print(idprint_chat"You have selected Playtime Menu");
        }
        case 
4:
        {
            
client_cmd(id"say /cashtop")
            
client_print(idprint_chat"You have selected Cashtop");
        }
        case 
5:
        {
            
client_cmd(id"say /rules")
            
client_print(idprint_chat"You have selected Rules");
        }
        case 
6:
        {
            
show_menu_team(id)
        }
    }
    
    
menu_destroy(menu);
    
    return 
PLUGIN_HANDLED;
}
public 
show_menu_team(id)
{
    
    new 
Menu menu_create("\yTeam menu""Main")
    
    
menu_additem(Menu"Go to Terro""1"0)
    
menu_additem(Menu"Go to Spec""2"0)
    
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL );
    
menu_setprop(MenuMPROP_EXITNAME"\dClose" )
    
menu_setprop(MenuMPROP_NUMBER_COLOR"\r" )
    
menu_display(idMenu0)
    
}

public 
Main(idMenuitem)
{      
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(Menu);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(Menuitemaccessdata6iName63callback)
    
    new 
key str_to_num(data);
    
    switch(
key)
    {
        case 
1:
        {
            if (
cs_get_user_team(id) == CS_TEAM_T)
            {
                
client_print(id,print_chat,"You are already Terro")
            }
            else
            {
                
cs_set_user_team(id,CS_TEAM_T)    
            }
        }
        case 
2:
        {
            if (
cs_get_user_team(id) == CS_TEAM_SPECTATOR)
            {
                
client_print(id,print_chat,"You are already Spec")
            }
            else
            {
                
cs_set_user_team(id,CS_TEAM_SPECTATOR)    
            }
        }
    }
    
menu_destroy(Menu);
    return 
PLUGIN_HANDLED;



nixh 05-31-2014 14:35

Re: Doesnt compile
 
Thanks guys, but non of them worked when i press M(chooseteam) the menu doest show. :(

Fuck For Fun 05-31-2014 14:51

Re: Doesnt compile
 
Quote:

Originally Posted by nixh (Post 2144919)
Thanks guys, but non of them worked when i press M(chooseteam) the menu doest show. :(

Put the Plugins first, after all the Plugins you put in plugins.ini


All times are GMT -4. The time now is 09:48.

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