[INC] Fallout's New Menu Styles. Updated: V4 (new functions) -
ғαιιοцт - 13.02.2009
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:
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);
Re: [INC] Fallout's New Menu Styles. -
Maercell - 13.02.2009
Woowww... really nice!
Better than the normal menus.
Well done
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 13.02.2009
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 ><
Re: [INC] Fallout's New Menu Styles. -
harrold - 13.02.2009
Good man i had the same idea xD
Re: [INC] Fallout's New Menu Styles. -
Jese - 13.02.2009
Good work Fallout!
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 13.02.2009
Quote:
Originally Posted by harrold
Good man i had the same idea xD
|
Quote:
Originally Posted by *Jesenice*
Good work Fallout!
|
ty
Re: [INC] Fallout's New Menu Styles. -
Grove - 13.02.2009
They look nice, but what is wrong with the normal menus?
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 13.02.2009
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)
Re: [INC] Fallout's New Menu Styles. -
Kanji_Suzuki - 13.02.2009
wow love the look of it, well done
Re: [INC] Fallout's New Menu Styles. -
Dinero - 13.02.2009
Looks very cool man nice work!
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 14.02.2009
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
Re: [INC] Fallout's New Menu Styles. -
farse - 14.02.2009
Lol, look nice,
Great job
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 14.02.2009
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
Re: [INC] Fallout's New Menu Styles. -
MenaceX^ - 14.02.2009
Nice idea ; )
Re: [INC] Fallout's New Menu Styles. -
SpiderPork - 14.02.2009
Well done, Fallout. I am almost sure I'll be using it.
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 14.02.2009
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
Re: [INC] Fallout's New Menu Styles. -
AlExAlExAlEx - 15.02.2009
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
Re: [INC] Fallout's New Menu Styles. -
ғαιιοцт - 15.02.2009
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
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
Re: [INC] Fallout's New Menu Styles. -
AlExAlExAlEx - 16.02.2009
would be nice to go with down and up arrow.
Re: [INC] Fallout's New Menu Styles. -
Nubotron - 16.02.2009
It looks like yom/0rb's menus, but his are a lot better
, but yours is not bad!