15.05.2015, 14:15
(
Последний раз редактировалось Gammix; 06.09.2017 в 12:43.
)
GMenu.inc
Version: 2.2.0 | Last Updated: 5 Sept, 2017
GTA V themed interaction menus for SA-MP. Works almost the same way and so does the design. You can customize the menu, like changing the colors and background sprite.Version: 2.2.0 | Last Updated: 5 Sept, 2017
Menu callbacks are handled the same way easydialog.inc does.
Screenshot:
Functions:
PHP код:
ShowPlayerMenu(playerid, menuid[], caption[], type[] = "INTERACTION MENU", captionTextColor = 0xf7f7f7ff, captionBoxColor = 0xdb0dd0bb, captionSprite[] = "loadsc12:loadsc12");
- "menuid" - Just like easydialog include, you can put any name and you dont need to define it.
- "caption" - heading of menu
- "type" - Little text to descript menu (don't make this longer than 30 characters)
- "captionTextColor" - self explainatory
- "captionBoxColor" - self explainatory
- "captionSprite" - The background picture of caption
PHP код:
AddPlayerMenuItem(playerid, text[], info[] = "");
- "text" - The listitem's text
- "info" - A side note/information about the listitem. Optional, leave this param empty for no information box will be shown
PHP код:
HidePlayerMenu(playerid);
Macros:
The following list of macros, you can redefine before inclusion:
PHP код:
#define MENU_SOUND_UPDOWN \
1054 // the sound id which will be played when you go up/down listitems
#define MENU_SOUND_CLOSE \
1084 // the sound id which will be played when you close menu
#define MENU_SOUND_SELECT \
1083 // the sound id which will be played when you select a listitem
#define MENU_MAX_LISTITEMS \
24 // maximum listitems a menu can have, the array size holding menu information
#define MENU_MAX_LISTITEM_SIZE \
128 // maximum string size of a listitem
#define MENU_MAX_LISTITEMS_PERPAGE \
8 // how many lisitems you want to be shown in a page
PHP код:
MENU_RESPONSE_UP // used in callback (when player press UP key to go upwards in menu)
MENU_RESPONSE_DOWN // used in callback (when player press DOWN key to go downwards in menu)
MENU_RESPONSE_SELECT // used in callback (when player press SPACE key to select a listitem)
MENU_RESPONSE_CLOSE // used in callback (when player press ENTER key to close menu)
Shows player a weapon menu on every spawn:
[Notice how menu callbacks are handled, if you are not familiar with how easydialog.inc works]
PHP код:
#define FILTERSCRIPT
#include <a_samp>
#include <gmenu>
public OnPlayerSpawn(playerid)
{
ShowPlayerMenu(playerid, WEAPONS, "Weapons Menu");
AddPlayerMenuItem(playerid, "Katana");
AddPlayerMenuItem(playerid, "Chainsaw");
AddPlayerMenuItem(playerid, "Grenade", "Lethal weapon, will cost you $5,000 per grenade!");
AddPlayerMenuItem(playerid, "Molotov Cocktail", "Lethal weapon, will cost you $5,000 per moltov!");
AddPlayerMenuItem(playerid, "Desert Eagle");
AddPlayerMenuItem(playerid, "RPG", "Lethal weapon, will cost you $10,000 per rocket!");
AddPlayerMenuItem(playerid, "Minigun", "Best weapon of game, this is surely worth $100,000!");
return 1;
}
Menu:WEAPONS(playerid, response, listitem)
{
if (response == MENU_RESPONSE_SELECT)
{
switch (listitem)
{
case 0:
{
GivePlayerWeapon(playerid, 8, 1);
}
case 1:
{
GivePlayerWeapon(playerid, 9, 1);
}
case 2:
{
if (GetPlayerMoney(playerid) < 5000)
{
return SendClientMessage(playerid, 0xFF0002FF, "You need $5,000 to purchase a Greande.");
}
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 16, 1);
}
case 3:
{
if (GetPlayerMoney(playerid) < 5000)
{
return SendClientMessage(playerid, 0xFF0002FF, "You need $5,000 to purchase a Molotov Cocktail.");
}
GivePlayerMoney(playerid, -5000);
GivePlayerWeapon(playerid, 18, 1);
}
case 4:
{
GivePlayerWeapon(playerid, 24, 50);
}
case 5:
{
if (GetPlayerMoney(playerid) < 10000)
{
return SendClientMessage(playerid, 0xFF0002FF, "You need $10,000 to purchase a RPG.");
}
GivePlayerMoney(playerid, -10000);
GivePlayerWeapon(playerid, 35, 1);
}
case 6:
{
if (GetPlayerMoney(playerid) < 100000)
{
return SendClientMessage(playerid, 0xFF0002FF, "You need $100,000 to purchase a Minigun.");
}
GivePlayerMoney(playerid, -100000);
GivePlayerWeapon(playerid, 38, 1000);
}
}
}
return 1;
}
https://github.com/Agneese-Saini/SA-...lude/gmenu.inc