samp.directory
← Scripts and libraries

Straydet/Menu-Floating

A floating menu for SAMP can select any option using the cursor.

Library★ 0updated Mar 2026No licencePawn
Open on GitHub

This repository has no licence file. It is public to read, but that alone does not give permission to reuse it.

README.md

Library for sa-mp and open.mp

Functions

ShowMenuFloatingForPlayer(playerid, extraid, const header[], header_colour, const list_items[][]);
HideMenuFloatingForPlayer(playerid);

Callbacks

public OnPlayerMenuFloatingResponse(playerid, extraid, bool:response, listitem)
{
    return 1;
}

Screenshots

How do I use it?

Example

#define FILTERSCRIPT
#include <a_samp>
#include <zcmd>
#include <menu-floating>

enum
{
    MENU_FLOATING_HOSPITAL,
    MENU_FLOATING_TELEPORTES,
    MENU_FLOATING_WEAPONS,
}

CMD:hospital(playerid)
{
    static const items[][] =
    {
        "Atencion",
        "Ver historial ~p~nuevo!"
    };
    ShowMenuFloatingForPlayer(playerid, MENU_FLOATING_HOSPITAL, "Hospital", 0xDA2B2BFF, items);
    return 1;
}

CMD:teleportes(playerid)
{
    static const items[][] =
    {
        "Los Santos",
        "San Fierro",
        "Las Venturas"
    };
    ShowMenuFloatingForPlayer(playerid, MENU_FLOATING_TELEPORTES, "Teleportes", 0x445750FF, items);
    return 1;
}


CMD:weapons(playerid)
{
    static const items[][] =
    {
	    "Tec-9",
	    "Micro Uzi",
	    "M4A1_____________~g~~h~~h~100$",
	    "MP5______________~g~~h~~h~350$",
	    "Desert Eagle"
    };
    ShowMenuFloatingForPlayer(playerid, MENU_FLOATING_WEAPONS, "Weapons", 0xDA2B2BFF, items);
    return 1;
}


public OnPlayerMenuFloatingResponse(playerid, extraid, bool:response, listitem)
{
    /*new string[128];
    format(string, sizeof string, "[DEBUG] extraid = %i, response = %s, listitem = %i", extraid, response ? ("true") : ("false"), listitem);
    SendClientMessage(playerid, 0xCDCDCDFF, string);*/

    switch (extraid)
    {
        //--------------------------------------------------------------------//
        case MENU_FLOATING_HOSPITAL:
        {
            if (!response)
                return 0;

            switch (listitem)
            {
                case 0: SendClientMessage(playerid, -1, "* Atencion");
                case 1: SendClientMessage(playerid, -1, "* Historial");
            }
        }
        //--------------------------------------------------------------------//
        case MENU_FLOATING_TELEPORTES:
        {
            if (!response)
                return 0;

            HideMenuFloatingForPlayer(playerid);

            switch (listitem)
            {
                case 0:
                {
                    SetPlayerPos(playerid, 1547.2209, -1681.7416, 13.5588);
                    SetPlayerFacingAngle(playerid, 90.0);
                }
                case 1:
                {
                    SetPlayerPos(playerid, -1583.6185, 809.6888, 6.8203);
                    SetPlayerFacingAngle(playerid, 270.0);
                }
                case 2:
                {
                    SetPlayerPos(playerid, 1592.3444, 1817.8513, 10.8203);
                    SetPlayerFacingAngle(playerid, 360.0);
                }
            }

            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
        }
        //--------------------------------------------------------------------//
		case MENU_FLOATING_WEAPONS:
		{
		    if (!response)
		        return 0;

		    HideMenuFloatingForPlayer(playerid);

		    switch (listitem)
		    {
		        case 0: // Tec-9 - gratis
		        {
		            GivePlayerWeapon(playerid, 32, 164);
		            SendClientMessage(playerid, -1, "* Has obtenido una Tec-9 Gratis!");
		        }
		        case 1: // Micro Uzi - gratis
		        {
		            GivePlayerWeapon(playerid, 28, 1000);
		            SendClientMessage(playerid, -1, "* Has obtenido una Micro Uzi Gratis!");
		        }
		        case 2: // M4A1 - 100$
		        {
		            new precio = 100;
		            new dinero = GetPlayerMoney(playerid);

		            if (dinero >= precio)
		            {
		                GivePlayerWeapon(playerid, 31, 500); // M4A1
		                GivePlayerMoney(playerid, -precio);
		                SendClientMessage(playerid, -1, "* Has comprado un M4A1 por 100$");
		            }
		            else
		            {
		                new faltante = precio - dinero;
		                new msg[64];
		                format(msg, sizeof msg, "* Te falta %d$ para comprar el M4A1", faltante);
		                SendClientMessage(playerid, 0xFF0000FF, msg);
		            }
		        }
		        case 3: // MP5 - 350$
		        {
		            new precio = 350;
		            new dinero = GetPlayerMoney(playerid);

		            if (dinero >= precio)
		            {
		                GivePlayerWeapon(playerid, 29, 500); // MP5
		                GivePlayerMoney(playerid, -precio);
		                SendClientMessage(playerid, -1, "* Has comprado un MP5 por 350$");
		            }
		            else
		            {
		                new faltante = precio - dinero;
		                new msg[64];
		                format(msg, sizeof msg, "* Te falta %d$ para comprar el MP5", faltante);
		                SendClientMessage(playerid, 0xFF0000FF, msg);
		            }
		        }
		        case 4: // Desert Eagle - gratis
		        {
		            GivePlayerWeapon(playerid, 24, 1000);
		            SendClientMessage(playerid, -1, "* Has obtenido una Desert Eagle Gratis!");
		        }
		    }
		}
		//--------------------------------------------------------------------//
    }
    return 1;
}

Credits

filterscriptfsgta5gtavincincludeincludesmenumenu-floatingmenu-gtavopen-mppawnpawnosa-mpsamp

This page is built from what GitHub publishes about the repository. samp.directory does not host the code. Report a problem with this listing