[Include] [INC] Fallout's New Menu Styles. Updated: V4 (new functions)
#1

Fallout's New Menu Styles



I made a new menu type for sa-mp because the normal one can only have 12 rows, you can't change it's colors, ...
This one is easy to use (most of the functions are the same as the normal ones)

Features:
- Maximum rows of a menu = 20 now (you can change it to more but than you may exceed the maximum amount of textdraws if you have many menus)
- You can change the color of every part of the menu (text colors, background colors, box colors)
- Adjustable position
- Adjustable box length (the length of the background of your menu)

Functions:
Code:
native F_CreateMenu(title[], Float:x, Float:y, Float:boxlength); //returns the ID of the created menu (starting at ID 0)
native F_DestroyMenu(menuid);
native F_HideMenuForPlayer(menuid, playerid);
native F_ShowMenuForPlayer(menuid, playerid);
native F_AddMenuItem(menuid, title[]); //returns the ID of the created menu item (starting at ID 0)

native F_SetMenuTitleTextColor(menuid, color);
native F_SetMenuTitleBgColor(menuid, color); //(bg = background)
native F_SetMenuTitleBoxColor(menuid, color);

native F_SetMenuItemTextColor(menuid, color);
native F_SetMenuItemBgColor(menuid, color); //(bg = background)
native F_SetMenuItemBoxColor(menuid, color);

native F_SetMenuSelectedItemTextColor(menuid, color);
native F_SetMenuSelectedItemBgColor(menuid, color); //(bg = background)
native F_SetMenuSelectedItemBoxColor(menuid, color);

//Only for V4:
native F_ShowMenuForAll(menuid);
native F_HideMenuForAll(menuid);
native F_SelectMenuRow(menuid, playerid, row);
Example:
I've made a little example for you:
the 1st menu is an example of a menu with submenus and standard colors (if you didn't change the standard colors)
the 2nd, 3rd and 4th are the submenus of the 1st example, and have different collor combinations and positions (just as an example)

link of example code:
http://pastebin.com/f1c9eebd0

pictures of examples:





Download:

V1


V2


V3


V4


How to install:

V1
- Put this inc in this folder: server\pawno\include\<here>
- Add #include <F_Menu> to any script where you want to use it.
- Add F_OnPlayerKeyStateChange(playerid, newkeys); under OnPlayerKeyStateChange(playerid, newkeys, oldkeys)

V2
- Put this inc in this folder: server\pawno\include\<here>
- Add #include <F_Menu> to any script where you want to use it.
- Add F_Menu_OnInit(); under OnFilterScriptInit() or under OnGameModeInit() (depends on what type of script you use)

V3
- Put this inc in this folder: server\pawno\include\<here>
- Add #include <F_Menu> to any script where you want to use it.
- Add F_Menu_OnInit(); under OnFilterScriptInit() or under OnGameModeInit() (depends on what type of script you use)

V4
- Put this inc in this folder: server\pawno\include\<here>
- Add #include <F_Menu> to any script where you want to use it.
- Add F_Menu_OnInit(); under OnFilterScriptInit() or under OnGameModeInit() (depends on what type of script you use)

Keys:

V1
menu item up = VEHICLE_LOOKLEFT
menu item down = VEHICLE_LOOKRIGHT
exit = VEHICLE_ENTER_EXIT (enter)
select = PED_SPRINT (shift or space)

V2
menu item up = arrow up
menu item down = arrow down
exit = VEHICLE_ENTER_EXIT (enter)
select = PED_SPRINT (shift or space)

V3
menu item up = arrow up
menu item down = arrow down
exit = VEHICLE_ENTER_EXIT (enter)
select = PED_SPRINT (shift or space)

V4
menu item up = arrow up
menu item down = arrow down
exit = VEHICLE_ENTER_EXIT (enter)
select = PED_SPRINT (shift or space)

Changelog:

V1
first release

V2
- Keys changed to arrow keys instead of numpads.
(like normal menu's now)
- When holding down a key, you can scroll faster to another menu-item.

V3
- Fixed some bugs.

V4
- Code optimised.
- New functions:
Code:
native F_ShowMenuForAll(menuid);
native F_HideMenuForAll(menuid);
native F_SelectMenuRow(menuid, playerid, row);
How to use:
The menus (F_CreateMenu()) return an id, so you can do this at the top:

Code:
new MyMenu;
then you assign MyMenu to a menu (possibly under OnGameModeInit):

Code:
MyMenu = F_CreateMenu(title[], Float:x, Float:y);
next step: adding rows (menu items) to the menu:

Code:
F_AddMenuItem(MyMenu, "Row1");
F_AddMenuItem(MyMenu, "Row2");
F_AddMenuItem(MyMenu, "Row3");
//...
Unnecessary: changing the colors of the menu:

you can use:
Code:
F_SetMenuTitleTextColor(menuid, color);
F_SetMenuTitleBgColor(menuid, color); (bg = background)
F_SetMenuTitleBoxColor(menuid, color);

F_SetMenuItemTextColor(menuid, color);
F_SetMenuItemBgColor(menuid, color); (bg = background)
F_SetMenuItemBoxColor(menuid, color);

F_SetMenuSelectedItemTextColor(menuid, color);
F_SetMenuSelectedItemBgColor(menuid, color); (bg = background)
F_SetMenuSelectedItemBoxColor(menuid, color);
example:
Code:
F_SetMenuTitleTextColor(MyMenu , 0xFF3399AA);
and at least: show the code:
Code:
F_ShowMenuForPlayer(MyMenu, playerid);
or hide it:
Code:
F_HideMenuForPlayer(MyMenu, playerid);
and maybe destroy it:
Code:
F_DestroyMenuForPlayer(MyMenu);
Reply
#2

Woowww... really nice!
Better than the normal menus.
Well done
Reply
#3

Quote:
Originally Posted by Maercell
Woowww... really nice!
Better than the normal menus.
Well done
thx Maercell
I hope it works good, i didn't find any bugs yet and let's keep it that way ><
Reply
#4

Good man i had the same idea xD
Reply
#5

Good work Fallout!
Reply
#6

Quote:
Originally Posted by harrold
Good man i had the same idea xD
Quote:
Originally Posted by *Jesenice*
Good work Fallout!
ty
Reply
#7

They look nice, but what is wrong with the normal menus?
Reply
#8

Quote:
Originally Posted by Jay_
They look nice, but what is wrong with the normal menus?
only 12 menu rows (or 13?) and this looks better (i think because you can make as many color combinations as you want)
Reply
#9

wow love the look of it, well done
Reply
#10

Looks very cool man nice work!
Reply
#11

Quote:
Originally Posted by J.Bull
wow love the look of it, well done
Quote:
Originally Posted by Dinero
Looks very cool man nice work!
thanks
Reply
#12


Lol, look nice,
Great job
Reply
#13

Quote:
Originally Posted by Farse
Lol, look nice,
Great job
ty Farse

I've just tested the menus with more than 1 player (didn't test that before ><)
and everything works great
Reply
#14

Nice idea ; )
Reply
#15

Well done, Fallout. I am almost sure I'll be using it.
Reply
#16

Quote:
Originally Posted by MenaceX^
Nice idea ; )
yea the idea was cool, and easy to make but I'll make a new version where it looks better ^^
Quote:
Originally Posted by SpiderPork
Well done, Fallout. I am almost sure I'll be using it.
thanks
Reply
#17

i love the 2nd example but i have only one problem..
i can't go down/up with the menu ingame.. wtf is
menu item up = VEHICLE_LOOKLEFT
menu item down = VEHICLE_LOOKRIGHT
Reply
#18

Quote:
Originally Posted by AppLeAppLeAppLe(AlExAlExAlEx)
i love the 2nd example but i have only one problem..
i can't go down/up with the menu ingame.. wtf is
menu item up = VEHICLE_LOOKLEFT
menu item down = VEHICLE_LOOKRIGHT
i have it on my numpads (4 and 6)
it's stupid that i can't use the up and down arrows they aren't detected

Quote:

i love the 2nd example

you can make as many color combinations as you want, it's not like it that you can only choose from one of the 4 exapmles
Reply
#19

would be nice to go with down and up arrow.
Reply
#20

It looks like yom/0rb's menus, but his are a lot better , but yours is not bad!
Reply


Forum Jump:


Users browsing this thread: 13 Guest(s)