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

move to trash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoGetSomeSleep
Senior Member
Join Date: Dec 2018
Location: Miami/Florida
Old 07-19-2019 , 15:11   move to trash
Reply With Quote #1

move to trash

Last edited by GoGetSomeSleep; 03-11-2020 at 14:36.
GoGetSomeSleep is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-19-2019 , 16:51   Re: No perm no chat
Reply With Quote #2

PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(Listener_Say"say");
    
AddCommandListener(Listener_Say"say_team");
}

public 
Action Listener_Say(int Client, const char[] sCommandint iArgs)
{
    if(
Client <= || Client MaxClients || !IsClientInGame(Client)) return Plugin_Handled;

    if(!
CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_RESERVATION))
    {
        
PrintToChat(Client"[SM] You cannot use the message box because you do not have permission");
        return 
Plugin_Handled;
    }

    return 
Plugin_Continue;

CliptonHeist is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-21-2019 , 17:56   Re: No perm no chat
Reply With Quote #3

Not sure if you can use | with CheckCommandAccess but you can try it:
PHP Code:
if(!CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_RESERVATION ADMFLAG_VOTE ADMFLAG_KICK)) 
Otherwise you could use overrides and assign a random command (e.g. "sm_somethingsomething") to those flags instead.
CliptonHeist is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-21-2019 , 19:41   Re: No perm no chat
Reply With Quote #4

A bit ugly but should work:
PHP Code:
public void OnPluginStart() 

    
AddCommandListener(Listener_Say"say"); 
    
AddCommandListener(Listener_Say"say_team"); 


public 
Action Listener_Say(int Client, const char[] sCommandint iArgs

    if(
Client <= || Client MaxClients || !IsClientInGame(Client)) return Plugin_Handled

    if(!
CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_RESERVATION) || !CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_VOTE) || !CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_KICK)) 
    { 
        
PrintToChat(Client"[SM] You cannot use the message box because you do not have permission"); 
        return 
Plugin_Handled
    } 

    return 
Plugin_Continue

CliptonHeist is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-22-2019 , 01:54   Re: No perm no chat
Reply With Quote #5

Oh my bad, should be && not ||
PHP Code:
if(!CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_RESERVATION) && !CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_VOTE) && !CheckCommandAccess(Client"sm_somethingsomething"ADMFLAG_KICK)) 
CliptonHeist 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 02:01.


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