Raised This Month: $ Target: $400
 0% 

Can somebody help :/ ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
InteX01
Senior Member
Join Date: Jan 2017
Old 02-12-2017 , 10:53   Can somebody help :/ ?
Reply With Quote #1

Code:
#include <amxmodx>
#include <amxmisc>

#define USERFLAG ADMIN_USER

public plugin_init() {
	register_clcmd("say", "usersay")
}
public usersay(id){
	if(get_user_flags(id) & USERFLAG)
	{
		return PLUGIN_HANDLED;
		ColorChat(id, GREEN, "[AMXX] ^3Chat is locked.")
	}
}
First im noob at this
I wanted to make LockChat plugin where Admin could lock chat by /lock - /unlock command to users with Z flag (just user)
Now i dont have idea how to make that or is it even possible :/
InteX01 is offline
Old 02-12-2017, 11:28
yas17sin
This message has been deleted by yas17sin. Reason: NVM
InteX01
Senior Member
Join Date: Jan 2017
Old 02-12-2017 , 11:35   Re: Can somebody help :/ ?
Reply With Quote #2

I dont think this is gonna work cuz it doesnt mute player from chat by typing that command...

(If user with flag z types /lock or /unlock its only gonna say "Chat is locked" but still be able to chat. That return PLUGIN_HANDLED; will just be used to hide the command, thats not what i wanted but thanks anyway )
InteX01 is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-12-2017 , 12:21   Re: Can somebody help :/ ?
Reply With Quote #3

maybe something like this should work.
PHP Code:
#include <amxmodx>
#include <amxmisc>
//#include <chatcolor>

#define ACSSES_LEVEL ADMIN_USER

public plugin_init() {
    
register_clcmd("say /lock""usersay")
    
register_clcmd("say /unlock""unsay")
}
public 
usersay(id)
{
    if(
get_user_flags(id) && ACSSES_LEVEL )
    {
        
client_cmd(id"amx_cvar hud_saytext_time 0")
        
//ColorChat(id, GREY, "[AMXX] ^3Chat is locked.")
        
client_print(idprint_chat"chat are now locked")
    }
    return 
PLUGIN_HANDLED;
}
public 
unsay(id)
{
    if(
get_user_flags(id) && ACSSES_LEVEL )
    {
        
client_cmd(id"amx_cvar hud_saytext_time 5")
        
//ColorChat(id, GREY, "[AMXX] ^3Chat is unlocked.")
        
client_print(idprint_chat,"chat are now unlocked")
    }
    return 
PLUGIN_HANDLED;


Last edited by yas17sin; 02-12-2017 at 12:56.
yas17sin is offline
Send a message via ICQ to yas17sin
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-12-2017 , 12:43   Re: Can somebody help :/ ?
Reply With Quote #4

No, it won't. It's not even correct.
Simply use a bool and toggle it true/false and return PLUGIN_HANDLED or PLUGIN_CONTINUE according to it.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-12-2017 , 12:48   Re: Can somebody help :/ ?
Reply With Quote #5

If you want it to allow say commands (/rs ..) to work use this.
PHP Code:
#include <amxmodx>

new bool:ChatLocked;

public 
plugin_init() {

    
register_plugin("Block Say""1.0""DoNii")

    
register_clcmd("say""block_say")
    
register_clcmd("say /lock""lock_say")
    
register_clcmd("say /unlock""unlock_say")
}

public 
block_say(id) {

    if(
ChatLocked)
    return 
PLUGIN_HANDLED_MAIN;

    return 
PLUGIN_CONTINUE;
}

public 
lock_say(id) {

    if(!(
get_user_flags(id) & ADMIN_USER)) 
    return 
PLUGIN_HANDLED;
    
    
ChatLocked true;
    
client_print(0print_chat"Chat Is Disabled")

    return 
PLUGIN_CONTINUE;    
}

public 
unlock_say(id) {

    if(!(
get_user_flags(id) & ADMIN_USER)) 
    return 
PLUGIN_HANDLED;
    
    if(
ChatLocked) {
        
ChatLocked false;
        
client_print(0print_chat"Chat Is Enabled")
    }
    
    
client_print(idprint_chat"Chat Is Already Enabled")
    return 
PLUGIN_CONTINUE;

Else if not, use this
PHP Code:
#include <amxmodx>

new bool:ChatLocked;

public 
plugin_init() {

    
register_plugin("Block Say""1.0""DoNii")

    
register_clcmd("say""block_say")
    
register_clcmd("say /lock""lock_say")
    
register_clcmd("say /unlock""unlock_say")
}

public 
block_say(id) {

    if(
ChatLocked)
    return 
PLUGIN_HANDLED;

    return 
PLUGIN_CONTINUE;
}

public 
lock_say(id) {

    if(!(
get_user_flags(id) & ADMIN_USER)) 
    return 
PLUGIN_HANDLED;
    
    
ChatLocked true;
    
client_print(0print_chat"Chat Is Disabled")

    return 
PLUGIN_CONTINUE;    
}

public 
unlock_say(id) {

    if(!(
get_user_flags(id) & ADMIN_USER)) 
    return 
PLUGIN_HANDLED;
    
    if(
ChatLocked) {
        
ChatLocked false;
        
client_print(0print_chat"Chat Is Enabled")
    }
    
    
client_print(idprint_chat"Chat Is Already Enabled")
    return 
PLUGIN_CONTINUE;

__________________

Last edited by edon1337; 02-12-2017 at 12:51.
edon1337 is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-12-2017 , 12:56   Re: Can somebody help :/ ?
Reply With Quote #6

Quote:
Originally Posted by yas17sin View Post
maybe something like this should work.
PHP Code:
#include <amxmodx>
#include <amxmisc>
//#include <chatcolor>

#define ACSSES_LEVEL ADMIN_USER

public plugin_init() {
    
register_clcmd("say /lock""usersay")
    
register_clcmd("say /unlock""unsay")
}
public 
usersay(id)
{
    if(
get_user_flags(id) && ACSSES_LEVEL )
    {
        
client_cmd(id"amx_cvar hud_saytext_time 0")
        
//ColorChat(id, GREY, "[AMXX] ^3Chat is locked.")
        
client_print(idprint_chat"chat are now locked")
    }
    return 
PLUGIN_HANDLED;
}
public 
unsay(id)
{
    if(
get_user_flags(id) && ACSSES_LEVEL )
    {
        
client_cmd(id"amx_cvar hud_saytext_time 5")
        
//ColorChat(id, GREY, "[AMXX] ^3Chat is unlocked.")
        
client_print(idprint_chat,"chat are now unlocked")
    }
    return 
PLUGIN_HANDLED;

actualy this did work i test it.
yas17sin is offline
Send a message via ICQ to yas17sin
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-12-2017 , 12:57   Re: Can somebody help :/ ?
Reply With Quote #7

Quote:
Originally Posted by yas17sin View Post
actualy this did work i test it.
What does 'hud_saytext_time 5' do ?
__________________

Last edited by edon1337; 02-12-2017 at 12:58.
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-12-2017 , 13:09   Re: Can somebody help :/ ?
Reply With Quote #8

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

#define USERFLAG ADMIN_USER

new bool:chat_locked

public plugin_init() {
        
register_plugin("Block the Chat""1.0""Natsheh")
    
register_clcmd("say""usersay")
        
register_clcmd("say_team""usersay")
        
register_clcmd("say /lock""lock_chat"ADMIN_KICK)
}

public 
lock_chat(idlevelcid)
{
             if(!
cmd_access(idlevelcid1)) return 1;

             
chat_locked chat_locked false:true
             ColorChat
(0GREEN"[AMXX] ^3The Chat has been %slocked."chat_locked "":"un")
             return 
0;
}
public 
usersay(id){
        if(!
chat_locked) return PLUGIN_CONTINUE;
        
    if(
get_user_flags(id) & USERFLAG)
    {
        
ColorChat(idGREEN"[AMXX] ^3Chat is locked.")
                return 
PLUGIN_HANDLED
    
}
        return 
PLUGIN_CONTINUE;


Last edited by Natsheh; 02-12-2017 at 13:24.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Natsheh
Veteran Member
Join Date: Sep 2012
Old 02-12-2017 , 13:12   Re: Can somebody help :/ ?
Reply With Quote #9

Quote:
Originally Posted by edon1337 View Post
What does 'hud_saytext_time 5' do ?
Its a cvar which dosent remove the chat actually but its a cvar controls the display time of the message.

Last edited by Natsheh; 02-12-2017 at 13:21.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-12-2017 , 13:15   Re: Can somebody help :/ ?
Reply With Quote #10

And how's that supposed to block the chat?
__________________
edon1337 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 21:04.


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