AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Showing enums at menu (https://forums.alliedmods.net/showthread.php?t=220060)

Kia 07-06-2013 11:36

Showing enums at menu
 
Hello everybody,

My brain don't want to tell me what I'm doing wrong here.
I just to print out the servers in a menu and console, but nothing happens.

Code:

/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN        "Server List"
#define AUTHOR        "Kia"
#define VERSION        "1.0.0"

#define MAXSERVER 4

new const szServerDescriptions[MAXSERVER][] =
{
        "bhop_* only (Skillpoints + Ranking)",
        "NightcrawlerZ",
        "Slender Mod",
        "Furien Mod"
}

new const szServerIPs[MAXSERVER][] =
{
        "x14pwnz.tk:27016",
        "x14pwnz.tk:27017",
        "x14pwnz.tk:27018",
        "x14pwnz.tk:27019"
}

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR)
       
        register_clcmd("say /servers",        "func_OpenServerList")
        register_clcmd("say servers",        "func_OpenServerList")

}

public func_OpenServerList(id)
{
        new menu = menu_create("Kia's Server - Server List^nServer List has been printed to your console","func_OpenServerList_handler")
       
        client_print(id, print_console, "######################################")
        client_print(id, print_console, "######################################")
        client_print(id, print_console, "######################################")
       
        for(new i; i<MAXSERVER; i++)
        {
                static szMenuTitle[64], szInfo[3], szConsoleString[64]
               
                formatex(szMenuTitle, charsmax(szMenuTitle), "%s - %s",szServerDescriptions[i],szServerIPs[i])
                num_to_str(i, szInfo, charsmax(szInfo))
                menu_additem(menu, szMenuTitle, szInfo)
               
                formatex(szConsoleString, charsmax(szConsoleString), "%s - connect %s", szServerDescriptions[i], szServerIPs[i])
        }
       
        client_print(id, print_console, "######################################")
        client_print(id, print_console, "######################################")
        client_print(id, print_console, "######################################")
       
        menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
        menu_display(id, menu, 0);
        return PLUGIN_HANDLED
}


fysiks 07-06-2013 14:39

Re: Showing enums at menu
 
If "nothing" happens then the function is not being called. Here is some advice, NEVER use the phrase "nothing happens"!!! It does not explain anything and just makes it take longer to try and help you.

Napoleon_be 07-06-2013 14:58

Re: Showing enums at menu
 
If you don't call your menu handler, the menu won't even pop up.

just make your menu handler even if there's nothing in there, and your menu will show up.

Kia 07-06-2013 16:38

Re: Showing enums at menu
 
*epic facepalm* Sorry, sorry, sorry, my bad. I went full retard again.


All times are GMT -4. The time now is 06:32.

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