SA-MP Forums Archive
[Include] Textdraw Menu - v1.0 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Textdraw Menu - v1.0 (/showthread.php?tid=548579)

Pages: 1 2


Textdraw Menu - v2.0 - Hirsw0w - 30.11.2014

Introduction

Well, I saw the option of clickable textdraws, I thought to my-self we could do menu with this and this wonderful idea, The Programming method isn't the ordinary way in sa-mp its take from cs 1.6 , the menus in cs 1.6 ( Counter-Strike 1.6 ) is like this , only with numbers, the functions like the Programming method on CS 1.6.

Functions
Use


Simple Textdraw menu Create ( without the handler ):

Код:
new menu = menu_create("header","sub_menu"); // create the menu and return the menuid

menu_additem(menu,"Weapon 1"); // Item 1
menu_additem(menu,"Weapon 2"); // Item 2

menu_edit(menu,MEDIT_STYLE,MENU_CENTERSTYLE); // edit menu style

menu_display(playerid,menu); // display the menu for player
Simple Textdraw menu Handler:

Код:
forward sub_menu(playerid,menu,item);
public sub_menu(playerid,menu,item) {

    if(item == MENU_EXIT) return SendClientMessage(playerid,-1, "you closed the menu");

    switch(item) {

        case 0: SendClientMessage(playerid,-1,"that the option Weapon 1");
        case 1: SendClientMessage(playerid,-1,"that the option Weapon 2");
    }

    return 1;
}
Simple Destroy Textdraw menu:

Код:
menu_destroy(playerid);
Example

Well, I created here Weapons menu that when you click on weapon that give you the weapon with 999 ammo.

That is the code:

Код:
#include <a_samp>
#include <tdmenu>

new Weapon[11][20] = {"AK47","M4","Tec-9","Country Rifle","Sniper Rifle","Deagle","Shotgun",
	"RPG","HS Rocket","Grenade","9mm"};
new Weaponi[11] = {30, 31, 32,33, 34,24,25,35,36,16,22};

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (!strcmp("/weaponsmenu", cmdtext, true))
	{
		new menu = menu_create("Weapons Menu","sub_menu");
		
		for(new i;i < 11;i++) menu_additem(menu,Weapon[i]);
		
		menu_edit(menu,MEDIT_STYLE,MEDIT_CENTERSTYLE);
		menu_edit(menu,MEDIT_USEBOXBUTTON,0);
		menu_edit(menu,MEDIT_BOXCOLOR,0x00688B);
		menu_edit(menu,MEDIT_HEADERCOLOR,0x8A2BE2);
		menu_edit(menu,MEDIT_BUTTONCOLOR ,0xCD3333);
		
		menu_display(playerid,menu);
		return 1;
	}
	return 0;
}

forward sub_menu(playerid,menu,item); // menu handler
public sub_menu(playerid,menu,item)
{
	if(item == MENU_EXIT) return 1;
	
	GivePlayerWeapon(playerid,Weaponi[item],999);
	
	
	return 1;
}
Bugs

1. Bug with the items in the pages [ FIXED v1.0.1 ]
2. Bug with whole code [ FIXED v2.0 ]

Pictures

Picture one:



Picture two:



Picture three : ( v2.0 pic )



that the pictures from the example code

Changelog

Version 1.0 - first release.

Version 1.0.1 - Fix bugs.

Version 2.0 - Fix Bugs and new Features:

1. edit the whole menu
2. new style added


Downloads

Pastebin - v2.0


Credits




Re: Textdraw Menu - v1.0 - Daewoo - 30.11.2014

Nice, i like it, but add a max char in button, because the text will come after you for the box

Translate by ****** translate


Re: Textdraw Menu - v1.0 - Hirsw0w - 30.11.2014

Quote:
Originally Posted by Daewoo
Посмотреть сообщение
Nice, i like it, but add a max char in button, because the text will come after you for the box

Translate by ****** translate
I will change it right now and edit the post,
thank you!


Re: Textdraw Menu - v1.0 - Crayder - 30.11.2014

Very nice job, REP4U...


Re: Textdraw Menu - v1.0 - Hirsw0w - 30.11.2014

Quote:
Originally Posted by Crayder
Посмотреть сообщение
Very nice job, REP4U...
thank you!


Re: Textdraw Menu - v1.0 - GuyYahood1 - 30.11.2014

Nice job!


Re: Textdraw Menu - v1.0 - Hirsw0w - 30.11.2014

Quote:
Originally Posted by GuyYahood1
Посмотреть сообщение
Nice job!
thanks you!


Re: Textdraw Menu - v1.0 - coloN - 01.12.2014

looks nice, gj.


Re: Textdraw Menu - v1.0 - Hirsw0w - 01.12.2014

Quote:
Originally Posted by coloN
Посмотреть сообщение
looks nice, gj.
thanks you!


Re: Textdraw Menu - v1.0 - JeaSon - 01.12.2014

nice work! .. Textdraws looks good + your code looks clean too


Re: Textdraw Menu - v1.0 - Hirsw0w - 01.12.2014

Quote:
Originally Posted by Namer
Посмотреть сообщение
nice work! .. Textdraws looks good + your code looks clean too
thank you!!

EDIT: Fixed bug with the pages.


Re: Textdraw Menu - v1.0 - Amit_B - 01.12.2014

Nice one!


Re: Textdraw Menu - v1.0 - Hirsw0w - 01.12.2014

Quote:
Originally Posted by Amit_B
Посмотреть сообщение
Nice one!
thank you!


Re: Textdraw Menu - v1.0 - LorDWarS - 01.12.2014

good job!


Re: Textdraw Menu - v1.0 - Hirsw0w - 01.12.2014

Quote:
Originally Posted by LorDWarS
Посмотреть сообщение
good job!
thanks!


Re: Textdraw Menu - v1.0 - Hirsw0w - 10.12.2014

Update: In the next few hours or tommrow will be version 2!

the version 2 will included: Textdraw menu with arrows, more one menu style menu, Setting the menu like you love that mean: button color,box color,header color, style , use box in buttons, and more!

be ready for version 2!


Re: Textdraw Menu - v1.0 - quark - 16.12.2014

Well, this dont work m8


Re: Textdraw Menu - v1.0 - $$inSane - 17.12.2014

Good job. I have some suggestions regarding the outlook:
- Improve texdraw size and fonts
- Custom colour for the menu
- Maybe keyboard controls like using arrow keys


Re: Textdraw Menu - v1.0 - quark - 17.12.2014

It gives me errors on compiling. I'm the only one?


Re: Textdraw Menu - v1.0 - bustern - 17.12.2014

Interesting, good job.