This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Player Menu


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ryan.Ls
Junior Member
Join Date: Feb 2011
Old 02-26-2014 , 19:55   Player Menu
Reply With Quote #1

I have implemented on the server commands, such as "/ server" "/ admins" "voteban" etc etc. .. I need to create a menu..

At the moment I have this but I'm missing something..

From already thank you very much.


Code:
#include <sourcemod>

public Plugin:myinfo =
{
    name = "test",
    author = "test",
    description = "test",
    version = "1.0",
    url = ""
};


public OnPluginStart()
{
    RegConsoleCmd("menu_test", Menu_Test);
}

public Action:Menu_Test(client, args)
{
    new Handle:menu = CreateMenu(Menu_Commands, MenuAction_Select | MenuAction_End | MenuAction_DisplayItem);
    SetMenuTitle(menu, "Player Commands");

    AddMenuItem(menu, "/admin", "Admins Online");
    AddMenuItem(menu, "/server", "Redirect Server");
    AddMenuItem(menu, "Voteban", "Voteban");
    AddMenuItem(menu, "votekick", "Votekick");
    AddMenuItem(menu, "/rs", "Reset Score");

    DisplayMenu(menu, client, MENU_TIME_FOREVER);
}

public Menu_Commands(Handle:menu, MenuAction:action, param1, param2)
{
    switch (action)
    {
        case MenuAction_Select:
        {
            //param1 is client, param2 is item

            new String:item[64];
            GetMenuItem(menu, param2, item, sizeof(item));

            if (StrEqual(item, "/admin"))
            {

            }
            else if (StrEqual(item, "/server"))
            {

            }
            else if (StrEqual(item, "Voteban"))
            {

            }
            else if (StrEqual(item, "votekick"))
            {

            }
            else if (StrEqual(item, "/rs"))
            {

            }
        }

        case MenuAction_End:
        {
            //param1 is MenuEnd reason, if canceled param2 is MenuCancel reason
            CloseHandle(menu);

        }

        case MenuAction_DisplayItem:
        {
            //param1 is client, param2 is item

            new String:item[64];
            GetMenuItem(menu, param2, item, sizeof(item));

            if (StrEqual(item, "/admin"))
            {
                new String:translation[128];
                Format(translation, sizeof(translation), "%T", "/admin", param1);
                return RedrawMenuItem(translation);
            }
            else if (StrEqual(item, "/server"))
            {
                new String:translation[128];
                Format(translation, sizeof(translation), "%T", "/server", param1);
                return RedrawMenuItem(translation);
            }
            else if (StrEqual(item, "Voteban"))
            {
                new String:translation[128];
                Format(translation, sizeof(translation), "%T", "Voteban", param1);
                return RedrawMenuItem(translation);
            }
            else if (StrEqual(item, "votekick"))
            {
                new String:translation[128];
                Format(translation, sizeof(translation), "%T", "votekick", param1);
                return RedrawMenuItem(translation);
            }
            else if (StrEqual(item, "/rs"))
            {
                new String:translation[128];
                Format(translation, sizeof(translation), "%T", "/rs", param1);
                return RedrawMenuItem(translation);
            }
        }

    }
    return 0;
}
Ryan.Ls is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-26-2014 , 23:37   Re: Player Menu
Reply With Quote #2

The MenuAction_Select handler isn't currently doing anything... it needs to be coded to call the various commands in the if/else if blocks.

You're probably better off using SourceMod's Custom Admin Menu system instead.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-26-2014 at 23:38.
Powerlord is offline
Ryan.Ls
Junior Member
Join Date: Feb 2011
Old 02-27-2014 , 01:23   Re: Player Menu
Reply With Quote #3

I'm sorry but I know nothing of SourceMod, the custom admin menu is for admins .. i need this manu for players (not admins).

sry my english
Ryan.Ls is offline
hamza47sohail
Senior Member
Join Date: Jan 2014
Old 02-27-2014 , 08:36   Re: Player Menu
Reply With Quote #4

Quote:
Originally Posted by Ryan.Ls View Post
I'm sorry but I know nothing of SourceMod, the custom admin menu is for admins .. i need this manu for players (not admins).

sry my english
Hi!
Use a menu called helpmenu.
By default its hooked to /helpmenu but you can easily modify the .sp file and hook to another chat command of your choice.
It also has Admins List built into it along with the map rotation. And it uses a cfg file in which you can put custom items with commands

If you are still confused I can make one for you. Contact me on steam.
steamcommunity.com/id/_Omniscient
__________________
The Server Is In CANADA GameTracker Is Being Weird
hamza47sohail is offline
Ryan.Ls
Junior Member
Join Date: Feb 2011
Old 02-27-2014 , 14:56   Re: Player Menu
Reply With Quote #5

Thx hamza47sohail

With that I open this menu command in the game?


and within the scripting folder, which is this. sp?

Last edited by Ryan.Ls; 02-27-2014 at 14:58.
Ryan.Ls is offline
hamza47sohail
Senior Member
Join Date: Jan 2014
Old 02-28-2014 , 10:19   Re: Player Menu
Reply With Quote #6

Quote:
Originally Posted by Ryan.Ls View Post
Thx hamza47sohail

With that I open this menu command in the game?


and within the scripting folder, which is this. sp?
Yes you open this menu ingame.
Here is the .SP File CLICK ME
__________________
The Server Is In CANADA GameTracker Is Being Weird
hamza47sohail is offline
Ryan.Ls
Junior Member
Join Date: Feb 2011
Old 02-28-2014 , 12:45   Re: Player Menu
Reply With Quote #7

I compile without problems but does not work, thanks anyway
Ryan.Ls is offline
Ryan.Ls
Junior Member
Join Date: Feb 2011
Old 02-28-2014 , 13:28   Re: Player Menu
Reply With Quote #8

I found this,

https://forums.alliedmods.net/showthread.php?t=72576

thanks
Ryan.Ls is offline
hamza47sohail
Senior Member
Join Date: Jan 2014
Old 03-01-2014 , 00:53   Re: Player Menu
Reply With Quote #9

Quote:
Originally Posted by Ryan.Ls View Post
If you want I can install/setup my donation menu etc but for a price.
Add me on steam if you are interested.
http://steamcommunity.com/id/_Omniscient
__________________
The Server Is In CANADA GameTracker Is Being Weird
hamza47sohail is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:41.


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