SA-MP Forums Archive
[Include] GMenus Include (stylish GTA V themed* interaction menus!) - 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] GMenus Include (stylish GTA V themed* interaction menus!) (/showthread.php?tid=574271)

Pages: 1 2 3


GMenus Include (stylish GTA V themed* interaction menus!) - Gammix - 15.05.2015

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.
Menu callbacks are handled the same way easydialog.inc does.

Screenshot:


Functions:
PHP код:
ShowPlayerMenu(playeridmenuid[], caption[], type[] = "INTERACTION MENU"captionTextColor 0xf7f7f7ffcaptionBoxColor 0xdb0dd0bbcaptionSprite[] = "loadsc12:loadsc12"); 
Show player a GMenu!
PHP код:
AddPlayerMenuItem(playeridtext[], info[] = ""); 
Add a listitem to your menu, plug'n'play feature. You can add anytime while the menu is shown.
PHP код:
HidePlayerMenu(playerid); 
Hide any active GMenu from player.

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 \
    
// how many lisitems you want to be shown in a page 
The following are constants (i.e. cannot be changed). You can use them in handling response in callback:
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) 
Example - Weapons 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(playeridWEAPONS"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(playeridresponselistitem)
{
    if (
response == MENU_RESPONSE_SELECT)
    {
        switch (
listitem)
        {
            case 
0:
            {
                
GivePlayerWeapon(playerid81);
            }
            
            case 
1:
            {
                
GivePlayerWeapon(playerid91);
            }
            case 
2:
            {
                if (
GetPlayerMoney(playerid) < 5000)
                {
                    return 
SendClientMessage(playerid0xFF0002FF"You need $5,000 to purchase a Greande.");
                }
                
GivePlayerMoney(playerid, -5000);
                
GivePlayerWeapon(playerid161);
            }
            case 
3:
            {
                if (
GetPlayerMoney(playerid) < 5000)
                {
                    return 
SendClientMessage(playerid0xFF0002FF"You need $5,000 to purchase a Molotov Cocktail.");
                }
                
GivePlayerMoney(playerid, -5000);
                
GivePlayerWeapon(playerid181);
            }
            case 
4:
            {
                
GivePlayerWeapon(playerid2450);
            }
            case 
5:
            {
                if (
GetPlayerMoney(playerid) < 10000)
                {
                    return 
SendClientMessage(playerid0xFF0002FF"You need $10,000 to purchase a RPG.");
                }
                
GivePlayerMoney(playerid, -10000);
                
GivePlayerWeapon(playerid351);
            }
            case 
6:
            {
                if (
GetPlayerMoney(playerid) < 100000)
                {
                    return 
SendClientMessage(playerid0xFF0002FF"You need $100,000 to purchase a Minigun.");
                }
                
GivePlayerMoney(playerid, -100000);
                
GivePlayerWeapon(playerid381000);
            }
        }
    }
    return 
1;

Download - Source:
https://github.com/Agneese-Saini/SA-...lude/gmenu.inc


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Sellize - 15.05.2015

Very cool, good job Gammix.


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Smileys - 15.05.2015

Yet another great release, well done Gammix!

I love the way you can customize colors and whatnot, the sounds and the use of keys instead of the mouse to navigate, excellent idea!

+REP, I'll probs use this in my future projects!

EDIT: darn, can't give rep to you for some reason, says I have to rep someone else first :/


Re: GMenus Include (stylish GTA V themed* interaction menus!) - iSkyline - 15.05.2015

God damn it, this is sick!
Now I can finally add some amazing textdraw-ed menus into my script (if you don't mind ).

+rep.


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Gammix - 16.05.2015

Thank you friends


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Crayder - 16.05.2015

Ah, this is cool. Resolution friendly?


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Gammix - 16.05.2015

Quote:
Originally Posted by Crayder
Посмотреть сообщение
Ah, this is cool. Resolution friendly?
Thanks, i haven't taken care of resolution that much!


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Pottus - 16.05.2015

I was taking a look into it and it looks like it is coded pretty good here is one thing I picked up on reading through.

Код:
	new index = (gMenu[menuid][M_LISTITEMS] + 1);
    if(index > MAX_MENU_ITEMS) return -1;
    index -= 1;
Why not just do it like this.

Код:
	new index = (gMenu[menuid][M_LISTITEMS]);
    if(index >= MAX_MENU_ITEMS) return -1;
The ordering in OnPlayerUpdate() could be done better for sure.

pawn Код:
new keys, updown, leftright;
    GetPlayerKeys(playerid, keys, updown, leftright);

    if(updown == KEY_DOWN)
    {
        if(GetPlayerMenuID(playerid) != INVALID_MENU_ID)
        {
You are already making function calls when you don't have to, this would be a better logical order.

Код:
    if(GetPlayerMenuID(playerid) != INVALID_MENU_ID)
	{
		new keys, updown, leftright;
		GetPlayerKeys(playerid, keys, updown, leftright);

		if(updown == KEY_DOWN)
		{
Another thing to keep in mind is you are using == to check for keys which will work but you can not be pressing any other keys! Usually keys are checked like below. I won't say this method as long as it was your intention for it to be that way.
Код:
if(updown & KEY_DOWN)
What I really need to do myself is polish off my GUI system that is used in Texture Studio the idea is to actually build an GUI editor using it's own GUI includes this way the system is developed on top of it's self for proof of concept.
Here - https://github.com/Pottus/Texture-St...ts/tstudio/gui


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Gammix - 16.05.2015

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Код:
	new index = (gMenu[menuid][M_LISTITEMS] + 1);
    if(index > MAX_MENU_ITEMS) return -1;
    index -= 1;
Why not just do it like this.

Код:
	new index = (gMenu[menuid][M_LISTITEMS]);
    if(index >= MAX_MENU_ITEMS) return -1;
Oh, yes.

Quote:
Originally Posted by Pottus
Посмотреть сообщение
The ordering in OnPlayerUpdate() could be done better for sure.

pawn Код:
new keys, updown, leftright;
    GetPlayerKeys(playerid, keys, updown, leftright);

    if(updown == KEY_DOWN)
    {
        if(GetPlayerMenuID(playerid) != INVALID_MENU_ID)
        {
You are already making function calls when you don't have to, this would be a better logical order.

Код:
    if(GetPlayerMenuID(playerid) != INVALID_MENU_ID)
	{
		new keys, updown, leftright;
		GetPlayerKeys(playerid, keys, updown, leftright);

		if(updown == KEY_DOWN)
		{
Yes, thats right.

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Another thing to keep in mind is you are using == to check for keys which will work but you can not be pressing any other keys! Usually keys are checked like below. I won't say this method as long as it was your intention for it to be that way.
Код:
if(updown & KEY_DOWN)
No that will work but for both KEY_DOWN and KEY_UP as well other keys. So that will probably collapse.


Updated the download !




playergui.pwn
You hooking mistake:
Quote:

#else
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnFilterScriptInit GUIP_OnGameModeInit
forward GUIP_OnGameModeInit();

#endif

pawn Код:
#define GUIValidIndex(%0) if(!GUIData[_:%0][GUIActive]) return 0
#define GUIValidElement(%0,%1) if(!GUIData[_:%0][GUIUsed][%1]) return 0
Or maybe this:
pawn Код:
#define GUIValidIndex(%0) return GUIData[_:%0][GUIActive]
#define GUIValidElement(%0,%1) return GUIData[_:%0][GUIUsed][%1]

The coding of your GUI is pretty good.
I like this method:
pawn Код:
#if defined FILTERSCRIPT
    public OnFilterScriptExit()
#else
    public OnGameModeExit()
#endif



Re: GMenus Include (stylish GTA V themed* interaction menus!) - Pottus - 16.05.2015

Yes I know about that problem lol, it was built for Texture Studio and still a prototype design


Re: GMenus Include (stylish GTA V themed* interaction menus!) - $$inSane - 16.05.2015

Amazing work Gammix (lovely design)!

REP+

EDIT: can't give right now!


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Excel™ - 16.05.2015

Very impressive.

BTW, when you have selected set to any other value, the rows starts with the number specified rather taking care of the page. I think you should make a better version of it or just remove it(not really required at the moment)!


Respuesta: GMenus Include (stylish GTA V themed* interaction menus!) - Whyd - 16.05.2015

really good job :O


Re: GMenus Include (stylish GTA V themed* interaction menus!) - J4Rr3x - 16.05.2015

Very nice!!


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Excips - 20.05.2015

Another awesome release from you. Good work!!


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Q_Lite - 24.05.2015

Very nice, Gonna switch to GMenus from SAMP menus


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Lorenc_ - 24.05.2015

It's creative, nice work! I reckon if you removed the shadows on the list items it would balance well aesthetically.


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Q_Lite - 24.05.2015

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
It's creative, nice work! I reckon if you removed the shadows on the list items it would balance well aesthetically.
Lol, those shadows make it look creative. And as its themed on GTA V interaction menus


Re: GMenus Include (stylish GTA V themed* interaction menus!) - Gammix - 24.05.2015

Thanks all for support.


Update | R2 - 24 May, 2015 Download available in thread.


Re: GMenus Include (stylish GTA V themed* interaction menus!) - SickAttack - 26.05.2015

May I ask, how do you calculate the total amount of pages in this include?