Raised This Month: $ Target: $400
 0% 

Showing enums at menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-06-2013 , 11:36   Showing enums at menu
Reply With Quote #1

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
}
__________________
Kia is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-06-2013 , 14:39   Re: Showing enums at menu
Reply With Quote #2

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.
__________________

Last edited by fysiks; 07-06-2013 at 14:40.
fysiks is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-06-2013 , 14:58   Re: Showing enums at menu
Reply With Quote #3

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.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 07-06-2013 , 16:38   Re: Showing enums at menu
Reply With Quote #4

*epic facepalm* Sorry, sorry, sorry, my bad. I went full retard again.
__________________
Kia 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 06:32.


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