Raised This Month: $89 Target: $400
 22% 

No perm no chat


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

I need a script to ensure that people who do not have ADMFLAG_RESERVATION perm do not send chat messages, also in an informative chat when they send a message:
"You cannot use the message box because you do not have permission"

I have searched a lot but could not find anyone who can help?
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
GoGetSomeSleep
Member
Join Date: Dec 2018
Location: Miami/Florida
Old 07-21-2019 , 13:39   Re: No perm no chat
Reply With Quote #3

can we accept all messages from this perms?
ADMFLAG_RESERVATION | ADMFLAG_VOTE | ADMFLAG_KICK
GoGetSomeSleep is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-21-2019 , 17:56   Re: No perm no chat
Reply With Quote #4

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
GoGetSomeSleep
Member
Join Date: Dec 2018
Location: Miami/Florida
Old 07-21-2019 , 19:30   Re: No perm no chat
Reply With Quote #5

I tried both ways it doesn't work. What if we disable the script for them by giving immunity to certain steam ids?
GoGetSomeSleep is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-21-2019 , 19:41   Re: No perm no chat
Reply With Quote #6

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
GoGetSomeSleep
Member
Join Date: Dec 2018
Location: Miami/Florida
Old 07-21-2019 , 20:03   Re: No perm no chat
Reply With Quote #7

Quote:
Originally Posted by CliptonHeist View Post
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

No one can write this way
GoGetSomeSleep is offline
GoGetSomeSleep
Member
Join Date: Dec 2018
Location: Miami/Florida
Old 07-21-2019 , 20:11   Re: No perm no chat
Reply With Quote #8

if no way to do this just ignore some steamid's like:

if player in ignore list(
STEAM_ID:1,
STEAM_ID:2,
STEAM_ID,
)
do nothing
GoGetSomeSleep is offline
CliptonHeist
Senior Member
Join Date: Feb 2016
Old 07-22-2019 , 01:54   Re: No perm no chat
Reply With Quote #9

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
GoGetSomeSleep
Member
Join Date: Dec 2018
Location: Miami/Florida
Old 07-22-2019 , 21:04   Re: No perm no chat
Reply With Quote #10

Quote:
Originally Posted by CliptonHeist View Post
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)) 
great thank you CliptonHeist <3
GoGetSomeSleep 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 06:37.


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