AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=58)
-   -   Menu help (https://forums.alliedmods.net/showthread.php?t=303378)

SnowWolf 12-04-2017 13:35

Menu help
 
Hello. I write "help me".

I registered command
RegConsoleCmd("sm_menu", cmd_menu);

I make : Public action cmd_menu, public void Table, Public MenuCallBack.
In menu call back i have:

public MenuCallBack(Handle:menu, MenuAction:action, client, position)
{
if ( action == MenuAction_Select )
{
decl String:item[40];
GetMenuItem(menu, position, item, sizeof(item));
if(StrEqual(item, "ws"))
{
PrintToChat(client,"Something")
}
}

How to change that when someone clicks on the menu "1. Menu WS" it will open the menu, which is under the command sm_ws

If someone needs more code I can send

brunoronning 12-04-2017 14:52

Re: Menu help
 
PHP Code:

ClientCommand(client"sm_ws"); 

??

SnowWolf 12-05-2017 07:57

Re: Menu help
 
Full plugin:

PHP Code:

#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>


public Plugin myinfo =
{
    
name "Menu",
    
author "SnowWolf",
    
description "Menu",
    
version "1.0",
    
url "steamcommunity.com/id/SnowWolfik"
};


public 
void OnPluginStart() 
{
    
RegConsoleCmd("sm_menu"cmd_menu);
}    

public 
Action cmd_menu(int clientint args)
{
    
tabeleczka(client);
    return 
Plugin_Handled;
}

public 
void tabeleczka(int client)
{
    
Handle menu CreateMenu(MenuCallBack);
    
SetMenuTitle(menu"Wybierz opcje:");
    
AddMenuItem(menu"ws""★ Wybór Skinów");
    
DisplayMenu(menuclientMENU_TIME_FOREVER);
}

public 
MenuCallBack(Handle:menuMenuAction:actionclientposition)
{
    if ( 
action == MenuAction_Select )
    {
        
decl String:item[40];
        
GetMenuItem(menupositionitemsizeof(item));
        if(
StrEqual(item"ws"))
        {
            
ClientCommand(client"sm_ws");
        }



compilation error:
D:\Komp\menu.sp(46) : error 030 : Compound statement not closed at the end of file <started at line 38>

What am I doing wrong?

Divin12 12-05-2017 08:11

Re: Menu help
 
Quote:

#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <sdkhooks>


public Plugin myinfo =
{
name = "Menu",
author = "SnowWolf",
description = "Menu",
version = "1.0",
url = "steamcommunity.com/id/SnowWolfik"
};


public void OnPluginStart()
{
RegConsoleCmd("sm_menu", cmd_menu);
}

public Action cmd_menu(int client, int args)
{
tabeleczka(client);
return Plugin_Handled;
}

public void tabeleczka(int client)
{
Handle menu = CreateMenu(MenuCallBack);
SetMenuTitle(menu, "Wybierz opcje:");
AddMenuItem(menu, "ws", "★ Wybór Skinów");
DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public MenuCallBack(Handle:menu, MenuAction:action, client, position)
{
if ( action == MenuAction_Select )
{
decl String:item[40];
GetMenuItem(menu, position, item, sizeof(item));
if(StrEqual(item, "ws"))
{
ClientCommand(client, "sm_ws");
}
}
}


All times are GMT -4. The time now is 13:20.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.