Raised This Month: $ Target: $400
 0% 

add text


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-16-2021 , 16:30   Re: add text
Reply With Quote #4

Use old style menu.
Code:
#include <amxmodx>

#if !defined MAX_MENU_LENGTH
	const MAX_MENU_LENGTH = 512
#endif

/*
 * @note Keys is a bitflag value that represents which keys the user can press
 *       on the menu. If you want to display disabled menu options, or skip
 *       certain number slots, you should exclude that key from the bitflag.
 *       amxconst.inc provides MENU_KEY_* constants for convenience.
 */

 const MY_CUSTOM_MENU_KEYS = -1 // -1 = all keys
 

public plugin_init()
{
	register_plugin("Plugin", "Version", "Author")

	register_menucmd(register_menuid("My Custom Menu"), MY_CUSTOM_MENU_KEYS, "MyCustomMenuHandler")

	register_clcmd("say /menu", "ShowMyCustomMenu")
}


public ShowMyCustomMenu(index)
{
	new body[MAX_MENU_LENGTH], len

	len += copy(body[len], charsmax(body) - len, "\yTitle^n^n\w")
	len += copy(body[len], charsmax(body) - len, "Text 1^n")
	len += copy(body[len], charsmax(body) - len, "Text 2^n")
	len += copy(body[len], charsmax(body) - len, "Text 3^n")
	len += copy(body[len], charsmax(body) - len, "Text 4^n")
	len += copy(body[len], charsmax(body) - len, "Text 5^n")
	len += copy(body[len], charsmax(body) - len, "Text 6^n")
	len += copy(body[len], charsmax(body) - len, "\r1. \woption 1^n")
	len += copy(body[len], charsmax(body) - len, "^n\r0. \wExit^n")

	show_menu(index, MY_CUSTOM_MENU_KEYS, body, -1, "My Custom Menu")
	return PLUGIN_HANDLED
}

public MyCustomMenuHandler(index, key)
{
	switch (key)
	{
		case 9: // exit
		{
			return PLUGIN_HANDLED
		}
	}

	ShowMyCustomMenu(index)
	return PLUGIN_HANDLED
}
If you need formatting, replace "copy" with "formatex".
By the way, that will work only with menus of one page. If you need multiple pages you will have to do it manually. Check out plmenu.sma
__________________









Last edited by CrazY.; 06-16-2021 at 16:34.
CrazY. 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 02:36.


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