samp.directory
← Scripts e bibliotecas

Straydet/GMenu

GTA V themed interaction menus for SA-MP. You can customize the menu.

Biblioteca★ 3atualizado mar. de 2026Sem licençaPawn
Abrir no GitHub

Este repositório não tem arquivo de licença. Ele é público para leitura, mas isso sozinho não dá permissão para reutilizar.

README.md

Index

Introduction

Changelog

Version 2.3.0

  • The PreviewModel for information was replaced with a notification sprite to reduce Lag or FPS loss.
  • The function TogglePlayerControllable (Freeze/Unfreeze) was added to activate when the menu is opened and closed (in all cases, Space, Enter, HidePlayerMenu).
  • The main banner was changed to a dark red color.
  • The FixText stock was added for Spanish, Portuguese, and other language texts.
  • The size of the item information text was slightly increased.
  • Some documentation has been added for guidance.

Screenshots

How do I use it?

Functions

ShowPlayerMenu(playerid, menuid[], caption[], type[] = "SELECCIONE UNA OPCIÓN", captionTextColor = 0x1B1B1BFF, captionBoxColor = 0xAC3E36BB, captionSprite[] = "loadsc12:loadsc12"); 

Show player a GMenu!

  • "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
AddPlayerMenuItem(playerid, text[], info[] = ""); 

Add a listitem to your menu, plug'n'play feature. You can add anytime while the menu is shown.

  • "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
HidePlayerMenu(playerid); 

Hide any active GMenu from player.

Macros

The following list of macros, you can redefine before inclusion:

#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 

The following are constants (i.e. cannot be changed). You can use them in handling response in callback:

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

Shows the player a weapons menu when using the menuv command and displays a menu to change the color of their vehicle when using the tuning command: [Notice how menu callbacks are handled, if you are not familiar with how easydialog.inc works]

#include <a_samp>
#include <gmenu>
#include <zcmd>

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, "* Necesitas $5.000 para comprar un Granada.");
                }
                GivePlayerMoney(playerid, -5000);
                GivePlayerWeapon(playerid, 16, 1);
            }
            case 3:
            {
                if (GetPlayerMoney(playerid) < 5000)
                {
                    return SendClientMessage(playerid, 0xFF0002FF, "* Necesitas $5.000 para comprar un 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, "* Necesitas $10.000 para comprar un RPG");
                }
                GivePlayerMoney(playerid, -10000);
                GivePlayerWeapon(playerid, 35, 1);
            }
            case 6:
            {
                if (GetPlayerMoney(playerid) < 100000)
                {
                    return SendClientMessage(playerid, 0xFF0002FF, "* Necesitas $100.000 para comprar una Minigun.");
                }
                GivePlayerMoney(playerid, -100000);
                GivePlayerWeapon(playerid, 38, 1000);
            }
            
            case 7:
            {
                if (GetPlayerMoney(playerid) < 350)
                {
                    return SendClientMessage(playerid, 0xFF0002FF, "* Necesitas $350 para comprar una Combat Shotgun.");
                }
                GivePlayerMoney(playerid, -350);
                GivePlayerWeapon(playerid, 27, 1000);
            }
        }
    }
    return 1;
}
//----------------------------------------------------------------------------//
Menu:TUNING(playerid, response, listitem)
{
    new idveh = GetPlayerVehicleID(playerid);
    
    if (response == MENU_RESPONSE_SELECT)
    {
        switch (listitem)
        {
            case 0:
            {
                ChangeVehicleColor(idveh, 0, 0);
            }

            case 1:
            {
                ChangeVehicleColor(idveh, 1, 1);
            }
            case 2:
            {
                ChangeVehicleColor(idveh, 2, 2);
            }
            case 3:
            {
				ChangeVehicleColor(idveh, 3, 3);
            }
            case 4:
            {
                ChangeVehicleColor(idveh, 4, 4);
            }
            case 5:
            {
				ChangeVehicleColor(idveh, 5, 5);
            }
            case 6:
            {
				ChangeVehicleColor(idveh, 6, 6);
            }
            case 7:
            {
				ChangeVehicleColor(idveh, 7, 7);
            }
        }
    }
    return 1;
}
//----------------------------------------------------------------------------//
CMD:menuv(playerid)
{
    ShowPlayerMenu(playerid, WEAPONS, "Menu de Armas");
    AddPlayerMenuItem(playerid, "Katana");
    AddPlayerMenuItem(playerid, "Chainsaw");
    AddPlayerMenuItem(playerid, "Grenade", "Arma letal, te costará ~g~~h~$5,000 ~w~~h~por granada!");
    AddPlayerMenuItem(playerid, "Molotov Cocktail", "Arma letal, te costará ~g~~h~$5,000 ~w~~h~por molotov!");
    AddPlayerMenuItem(playerid, "Desert Eagle");
    AddPlayerMenuItem(playerid, "RPG", "Arma letal, te costará ~g~~h~$10,000 ~w~~h~por rocket!");
    AddPlayerMenuItem(playerid, "Minigun", "La mejor arma del juego, sin duda vale ~g~~h~$100,000!");
    AddPlayerMenuItem(playerid, "Combat Shotgun", "Precio: ~g~~h~$350");
	return 1;
}
//----------------------------------------------------------------------------//
CMD:tuning(playerid)
{
    if(!IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid, 0xFF0000FF, "* {FFFFFF}Debes estar dentro de un vehículo para usar este comando.");
        return 1;
    }

    ShowPlayerMenu(playerid, TUNING, "Tuning - Colores");
    AddPlayerMenuItem(playerid, "~l~0 (000000)");
    AddPlayerMenuItem(playerid, "~w~~h~1 (F5F5F5)");
    AddPlayerMenuItem(playerid, "~b~~h~2 (2A77A1)");
    AddPlayerMenuItem(playerid, "~r~3 (840410)");
    AddPlayerMenuItem(playerid, "~g~4 (263739)");
    AddPlayerMenuItem(playerid, "~r~~h~~h~~h~~h~~h~5 (86446E)");
    AddPlayerMenuItem(playerid, "~y~6 (D78E10)");
    AddPlayerMenuItem(playerid, "~b~~h~~h~7 (4C757F)");
	return 1;
}

Original

fsgmenugmenusgta5gtavgtav-menuincludeincludesmenu-gtavpawnpawnosa-mpsamp

Esta página é montada com o que o GitHub publica sobre o repositório. O samp.directory não hospeda o código. Avisar de um problema com esta página