Raised This Month: $51 Target: $400
 12% 

[L4D2] Block Status: add console message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
leonardo martinez
Member
Join Date: Jun 2014
Old 04-24-2021 , 10:50   [L4D2] Block Status: add console message
Reply With Quote #1

What this does is block the "status" command of the console, I would like it to be announced in the console with PrintToConsole, for example:

Code:
PrintToConsole(client, "You do not have access to this information");
PHP Code:
#include <sourcemod>
#pragma semicolon 1

public OnPluginStart()
{
    
RegConsoleCmd("status"Command_Block);
}

public 
Action:Command_Block(clientargs)
{
    return 
Plugin_Stop;
}

public 
Action:Command_JoinTeam(client_indexargs)
{
    if (
GetClientTeam(client_index) > 1)
        return 
Plugin_Handled;
    return 
Plugin_Continue;

leonardo martinez is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 04-25-2021 , 22:04   Re: [L4D2] Block Status: add console message
Reply With Quote #2

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required

ConVar g_hCommandAccess;
public 
void OnPluginStart()
{
    
g_hCommandAccess CreateConVar("l4d_status_commands_access_flag""z""Players with these flags have access to use status command. (Empty = Everyone, -1: Nobody)"FCVAR_NOTIFY);
    
    
RegConsoleCmd("status"Command_Block);
}

public 
Action Command_Block(int clientint args)
{
    if (
client == //server console
        
return Plugin_Continue;
    
    if(
HasAccess(client) == false)
    {
        
ReplyToCommand(client"You do not have access to this information");
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;
}

bool HasAccess (int client)
{
    
char g_sAcclvl[16];
    
g_hCommandAccess.GetString(g_sAcclvl,sizeof(g_sAcclvl));
    
    
// no permissions set
    
if (strlen(g_sAcclvl) == 0)
        return 
true;

    else if (
StrEqual(g_sAcclvl"-1"))
        return 
false;

    
// check permissions
    
int flag GetUserFlagBits(client);
    if ( 
flag ReadFlagString(g_sAcclvl) )
    {
        return 
true;
    }

    return 
false;

__________________

Last edited by HarryPotter; 04-25-2021 at 22:05.
HarryPotter 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 04:44.


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