Skip to content

dinhkhoi2298/menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Menu

sampctl

Installation

Simply install to your project:

sampctl package install roesanne26/menu

Include in your code and begin using the library:

#include <menu>

Functions

Menu_Add(playerid, const item[26])
Menu_SetColor(playerid, color)
Menu_Show(playerid, menuid, const tittle[] = "Menu", const header[] = "Interaction")
Menu_Hide(playerid)

Usage

#include <Pawn.CMD>
#include <menu>

stock HexReturn(rr, gg, bb, aa)
{
	return (aa & 0xFF) | ((bb & 0xFF) << 8) | ((gg & 0xFF) << 16) | (rr << 24);
}

CMD:ya(playerid, params[])
{
    if(Menu_Showing(playerid))
        return 1;

    for(new str[26], i = 0; i < strval(params) + 1; i ++)
    {
        format(str, 26, "Item %d", i);
        Menu_Add(playerid, str);
    }
    TogglePlayerControllable(playerid, 0);
    Menu_SetColor(playerid, HexReturn(51, 153, 255, 200)); // Dodger Blue
    Menu_Show(playerid, 1, "HELLO YOOY!", "Interaction");
    return 1;
} 

public OnMenuResponse(playerid, menuid, response, listitem)
{
    new 
        str[128];
    
    format(str, sizeof(str), "Menu=%d, Response=%d, Listitem=%d", menuid, response, listitem);
    SendClientMessage(playerid, -1, str);
    if(!response)
    {
        Menu_Hide(playerid);
        TogglePlayerControllable(playerid, 1);
    }
    return 1;
}

To test, simply run the package:

sampctl package run

Credits

  • Me

Releases

No releases published

Packages

No packages published

Languages