Raised This Month: $ Target: $400
 0% 

Maps menu, doesn't work say Map name


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
85filip58
Member
Join Date: Mar 2012
Old 10-27-2012 , 07:46   Re: Maps menu, doesn't work say Map name
Reply With Quote #10

Code:
#include <amxmodx>
#include <amxmisc>

#pragma semicolon 1

#define MAXMAPS  20
#define MAPLEN    64

new Maps[MAXMAPS][MAPLEN];

public plugin_init() 
{
	register_plugin("Menu by ini", "1.0", "Fedde");
	
	register_clcmd("say /maps","MapsMenu");
}

public MapsMenu(id) 
{
	
	new Menu = menu_create("Maps Menu :","MapsMenu_Handler");
	
	new Path[64];
	get_configsdir(Path,charsmax(Path));
	add(Path,charsmax(Path),"/maps.ini");
	
	new f = fopen(Path,"rt");
	
	new Mapname[MAPLEN];
	new Item;
	
	while(!feof(f) && Item < MAXMAPS)
	{
		fgets(f,Mapname,charsmax(Mapname));
		
		trim(Mapname);
		strtolower(Mapname);
		
		if(!Mapname[0] || Mapname[0] == ';'
		|| Mapname[0] == '/' && Mapname[1] == '/' ) continue;
		
		copy(Maps[Item],MAPLEN,Mapname);
		Item++;
		
		if(Item >= MAXMAPS) break;
		
		menu_additem(Menu,Mapname,Maps[Item]);
	}
	fclose(f);
	menu_display(id,Menu);
	return PLUGIN_HANDLED;
}

public MapsMenu_Handler(id,Menu,item)
{
	if(item == MENU_EXIT)
	{
		menu_destroy(Menu);
		return PLUGIN_HANDLED;
	}
	

	new iData[6];
	new iName[64];
	new Access;
	new Callback;

	menu_item_getinfo(Menu,item,Access,iData,5,iName,63,Callback);
	
	client_cmd(id, "say %s", Maps[item]);

	
	menu_destroy(Menu);
	return PLUGIN_HANDLED;
}
worked, thx Sunny, my friend
85filip58 is offline
 



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 00:06.


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