[Include] L_Menu
#1

L_Menu

L_Menu is a menu that displays for player (not clickable) but you will have to type in the text to choose

Functions

ShowPlayerMenu(playerid, header[], item1[], item2[], item3[], item4[], item5[], item6[], item7[], item8[], item9[],item10[], item11[], item12[], item13[], item14[], item15[], info[], main_box_color, header_box_color, info_box_color) - Create a menu for player

HidePlayerMenu(playerid) - Hide player menu

IsPlayerMenuActive(playerid) - Checks if player's menu is active


Callbacks

OnPlayerMenuResponse(playerid, choice) - Called when player input number

OnPlayerMenuClose(playerid) - Called when player closes Menu (presses LMB)




PASTEBIN: https://pastebin.com/LivcS3aT


PIC:


Click to see full picture



VIDEO: https://www.youtube.com/watch?v=EBoFPypPOGM




Script used in the video:



Code:
#include <a_samp>
#include <izcmd>

#undef MAX_PLAYERS
#define MAX_PLAYERS 20

new typee[MAX_PLAYERS];

#include <L_Menu>

#define  FILTERSCRIPT

CMD:menu(playerid, params[])
{
	typee[playerid] = 1; //youll need this if you want to create another menu that uses same number as others
	ShowPlayerMenu(playerid, "             ~g~~h~~h~Test", "~y~1. ~w~Heal", "~y~2. ~w~Armour", "~y~3. ~w~AK-47", "~y~4. ~w~MINIGUN", "~y~5. ~w~DEAGLE", "", "", "", "", "", "", "", "", "", "", "Type the number to choose to close press lmb", 0x00000066, 0xFFFFFF99, 0xFFFF0088);
	return 1;
}

CMD:menu2(playerid, params[])
{
	typee[playerid] = 2; //youll need this if you want to create another menu that uses same number as others //menu 3 will be 3 for example etc..
	ShowPlayerMenu(playerid, "             ~g~~h~~h~Test", "~g~~h~1. ~y~z+3", "~g~2. ~y~~h~z+10", "", "", "", "", "", "", "", "", "", "", "", "", "s", "Type the number to choose to close press lmb", 0xFF000088, 0x00000055, 0xFFFFFF77);
	return 1;
}

public OnPlayerMenuResponse(playerid, choice)
{
	switch(choice)
	{
	    case 1:
	    {
	        if(typee[playerid] == 1)
	        {
	        	SetPlayerHealth(playerid, 100.0);
	        	SendClientMessage(playerid, 0xFF0000FF, "Healed");
			}
			if(typee[playerid] == 2)
	        {
	        	new Float:x, Float:y, Float:z;
	        	GetPlayerPos(playerid, x, y, z);
	        	SetPlayerPos(playerid, x, y, z+3);
	        	SendClientMessage(playerid, -1, "z+3");
			}
		}
	    case 2:
	    {

	        if(typee[playerid] == 1)
	        {
				SetPlayerArmour(playerid, 100.0);
				SendClientMessage(playerid, -1, "Armour given");
			}
			if(typee[playerid] == 2)
	        {
	        	new Float:x, Float:y, Float:z;
	        	GetPlayerPos(playerid, x, y, z);
	        	SetPlayerPos(playerid, x, y, z+10);
	        	SendClientMessage(playerid, -1, "z+10");
			}
	    }
	    case 3:
	    {
	        if(typee[playerid] == 1) //if you have other menus that use those numbers use this
	        {
	        	GivePlayerWeapon(playerid, 30, 150);
	        	SendClientMessage(playerid, 0xFFFF00FF, "AK-47 given");
			}
		}
	    case 4:
	    {
	        if(typee[playerid] == 1)
	        {
	        	GivePlayerWeapon(playerid, 38, 580);
	        	SendClientMessage(playerid, 0xFFFF00FF, "MINIGUN given");
			}
		}
	    case 5:
	    {
	        if(typee[playerid] == 1)
	        {
	        	GivePlayerWeapon(playerid, 24, 125);
	        	SendClientMessage(playerid, 0xFFFF00FF, "DEAGLE given");
			}
		}
	}
	if(typee[playerid] == 1)
    {
		if(choice < 1 || choice > 5) return SendClientMessage(playerid, 0xFF0000FF, "Invalid choice");
	}
	else if(typee[playerid] == 2)
	{
		if(choice < 1 || choice > 2) return SendClientMessage(playerid, 0xFF0000FF, "Invalid choice");
	}
	return 1;
}

public OnPlayerMenuClose(playerid)
{
	if(typee[playerid] == 1) //if the first menu closed
	{
		SendClientMessage(playerid, 0xFF0000FF, "Menu 1 closed");
	}
	if(typee[playerid] == 2) //if the second menu closed
	{
	    SendClientMessage(playerid, 0xFF0000FF, "Menu 2 closed");
	}
	return  1;
}

Another way:



Code:
#include <a_samp>
#include <izcmd>

#undef MAX_PLAYERS
#define MAX_PLAYERS 20

#include <L_Menu>

#define FILTERSCRIPT

new pType[MAX_PLAYERS];

CMD:weapons(playerid, params[])
{
	pType[playerid] = 0;
	ShowPlayerMenu(playerid, "         ~g~~h~~h~Weapons", "~g~~h~~h~1~w~. ~y~Fist", "~g~~h~~h~2~w~. ~y~Brass Knuckle", "~g~~h~~h~3~w~. ~y~Golf Club", "~g~~h~~h~4~w~. ~y~Nite Stick", "~g~~h~~h~5~w~. ~y~Knife", "", "", "", "", "", "", "", "", "", "~g~~h~~h~15~w~. ~y~Vehicles Menu", "Weapons menu", 0xFFFFFF99, 0x00000066, 0x00000066);
	return 1;
}

CMD:vehicles(playerid, params[])
{
	pType[playerid] = 1;
	ShowPlayerMenu(playerid, "         Vehicles", "1. Infernus", "2. Cheetah", "3. Elegy", "", "", "", "", "", "", "", "", "", "", "", "Weapons menu", "Vehicles menu", 0x00FF0066, 0xFFFF0099, 0xFFFFFF88);
	return 1;
}

public OnPlayerMenuResponse(playerid, choice)
{
	new Float:x, Float:y, Float:z;
	switch(pType[playerid])
	{
	    case 0:
	    {
	    	switch(choice)
	    	{
	            case 1: GivePlayerWeapon(playerid, 0, 1);
				case 2: GivePlayerWeapon(playerid, 1, 1);
				case 3: GivePlayerWeapon(playerid, 2, 1);
				case 4: GivePlayerWeapon(playerid, 3, 1);
				case 5: GivePlayerWeapon(playerid, 4, 1);
				case 15: HidePlayerMenu(playerid), ShowPlayerMenu(playerid, "         Vehicles", "1. Infernus", "2. Cheetah", "3. Elegy", "", "", "", "", "", "", "", "", "", "", "", "15. Weapons menu", "Vehicles menu", 0x00FF0066, 0xFFFF0099, 0xFFFFFF88), pType[playerid] = 1;
				default: SendClientMessage(playerid, 0xFF0000FF, "Invalid choice");
			}
		}
		case 1:
		{
		    switch(choice)
		    {
		        case 1:
		        {
		            GetPlayerPos(playerid, x, y, z);
		            CreateVehicle(411, x+2, y+1, z+0.1, -1, -1, -1, -1);
		            SendClientMessage(playerid, 0xFFFF00FF, "Infernus spawned");
		        }
		        case 2:
		        {
		            GetPlayerPos(playerid, x, y, z);
		            CreateVehicle(415, x+2, y+1, z+0.1, -1, -1, -1, -1);
		            SendClientMessage(playerid, 0xFFFF00FF, "Infernus spawned");
		        }
		        case 3:
		        {
		            GetPlayerPos(playerid, x, y, z);
		            CreateVehicle(562, x+2, y+1, z+0.1, -1, -1, -1, -1);
		            SendClientMessage(playerid, 0xFFFF00FF, "Infernus spawned");
		        }
		        case 15: HidePlayerMenu(playerid), ShowPlayerMenu(playerid, "         ~g~~h~~h~Weapons", "~g~~h~~h~1~w~. Fist", "~g~~h~~h~2~w~. Brass Knuckle", "~g~~h~~h~3~w~. Golf Club", "~g~~h~~h~4~w~. Nite Stick", "~g~~h~~h~5~w~. Knife", "", "", "", "", "", "", "", "", "", "~g~~h~~h~15~w~. Vehicles Menu", "Weapons menu", 0xFFFFFF99, 0x00000066, 0x00000066), pType[playerid] = 0;
		        default: SendClientMessage(playerid, 0xFF0000FF, "Invalid choice");
		    }
		}
	}
	return 1;
}

public OnPlayerMenuClose(playerid)
{
	switch(pType[playerid])
	{
	    case 0: SendClientMessage(playerid, 0xFF0000FF, "Weapon menu closed");
	    case 1: SendClientMessage(playerid, 0xFF0000FF, "Vehicle menu closed");
	}
	return 1;
}

Requires: y_hooks



Credits

SAMP TEAM - for samp
ME - for L_Menu
Y_Less - for y_hooks
Adri1 - for his text draw editor
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)