Raised This Month: $32 Target: $400
 8% 

[CS:GO] Help to add a command to !admin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Audite
AlliedModders Donor
Join Date: Sep 2021
Location: Sweden
Old 10-07-2021 , 12:16   [CS:GO] Help to add a command to !admin
Reply With Quote #1

I have made a command, how to add it to admin menu.
I made respawn command and want now to add it to player section in admin menu.

How do I do that ? With client choice and everything ?
Audite is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 10-07-2021 , 12:50   Re: [CS:GO] Help to add a command to !admin
Reply With Quote #2

Try reading: https://wiki.alliedmods.net/Custom_A...enu_(SourceMod)
__________________
Marttt is offline
Audite
AlliedModders Donor
Join Date: Sep 2021
Location: Sweden
Old 10-07-2021 , 15:36   Re: [CS:GO] Help to add a command to !admin
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
Thanks for the link, but I still don't understand how to execute my respawn command with it and that players or aka clients list would be there. I'm working on essentials plugin, stuff that can be good for server to use and many stuff like that
Audite is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-07-2021 , 15:44   Re: [CS:GO] Help to add a command to !admin
Reply With Quote #4

https://wiki.alliedmods.net/Category...eMod_Scripting

or read plugins source code *.sp, from here forums or scripting folder
__________________
Do not Private Message @me
Bacardi is offline
Audite
AlliedModders Donor
Join Date: Sep 2021
Location: Sweden
Old 10-07-2021 , 15:50   Re: [CS:GO] Help to add a command to !admin
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
https://wiki.alliedmods.net/Category...eMod_Scripting

or read plugins source code *.sp, from here forums or scripting folder
Hahah I've been reading, I have figured out the custom admin thing, but I want to make it so if plugin loads then you have new tab. But since I'm new at this I don't know where to start. Would be awesome to get a tutor or something like that since there is no easy explanations how stuff work. It took me a whole day to figure out how to respawn a player.

For tutoring I would obwsl pay.
Audite is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-08-2021 , 08:19   Re: [CS:GO] Help to add a command to !admin
Reply With Quote #6

Be patient.
This is FORUM, you can create topic and leave it for answers.
But do not make multiple topics for same reason...
People help if they have free time and interest.

This is not good example, you can still get errors on special situations.
Name:  adminmenu.jpg
Views: 175
Size:  36.0 KB

PHP Code:
#undef REQUIRE_PLUGIN
#include <adminmenu>


TopMenu adminmenu;

public 
void OnPluginStart()
{
    
// register simple command
    
RegConsoleCmd("sm_mycommand"mycommand"This is my command");

    
TopMenu topmenu;
    if(
LibraryExists("adminmenu") && ((topmenu GetAdminTopMenu()) != null))
    {
        
OnAdminMenuReady(topmenu);
    }    
}

public 
void OnLibraryRemoved(const char[] name)
{
    if(
StrEqual(name"adminmenu"false))
    {
        
adminmenu null;
    }
}


// simple command callback
public Action mycommand(int clientint args)
{

    
PrintToServer("- client index %i This is my command. I executed my command"client);

    return 
Plugin_Handled;
}



public 
void OnAdminMenuReady(Handle htopmenu)
{
    
TopMenu topmenu TopMenu.FromHandle(htopmenu);

    if(
topmenu == adminmenu)
        return;

    
adminmenu topmenu;

    
Addmenuitems();
}


void Addmenuitems()
{
    
TopMenuObject player_commands adminmenu.FindCategory(ADMINMENU_PLAYERCOMMANDS);
    
    if(
player_commands == INVALID_TOPMENUOBJECT)
        return;

    
adminmenu.AddItem("sm_mycommand",
                    
menu_myhandler,
                    
player_commands,
                    
"menu_mycommand",
                    
0// 0 for public use, ADMFLAG_GENERIC for admin use
                    
"my command");
}

public 
void menu_myhandler(TopMenu topmenuTopMenuAction actionTopMenuObject topobj_idint paramchar[] bufferint maxlength)
{
    if(
action == TopMenuAction_DisplayOption)
    {
        
Format(buffermaxlength"My command Item name");
    }
    else if(
action == TopMenuAction_SelectOption)
    {
        
// in this action, param is client index
        // this execute command callback 'public Action mycommand(int client, int args)'
        
mycommand(param0);
    }

__________________
Do not Private Message @me

Last edited by Bacardi; 10-08-2021 at 08:32.
Bacardi is offline
Reply


Thread Tools
Display Modes

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 22:53.


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