13.02.2009, 21:14
(
Last edited by ғαιιοцт; 24/07/2010 at 12:45 PM.
)
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:
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:
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):
next step: adding rows (menu items) to the menu:
Unnecessary: changing the colors of the menu:
you can use:
example:
and at least: show the code:
or hide it:
and maybe destroy it:
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);
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);
The menus (F_CreateMenu()) return an id, so you can do this at the top:
Code:
new MyMenu;
Code:
MyMenu = F_CreateMenu(title[], Float:x, Float:y);
Code:
F_AddMenuItem(MyMenu, "Row1"); F_AddMenuItem(MyMenu, "Row2"); F_AddMenuItem(MyMenu, "Row3"); //...
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);
Code:
F_SetMenuTitleTextColor(MyMenu , 0xFF3399AA);
Code:
F_ShowMenuForPlayer(MyMenu, playerid);
Code:
F_HideMenuForPlayer(MyMenu, playerid);
Code:
F_DestroyMenuForPlayer(MyMenu);