Firstable , The Default Admin Flag is ADMIN_CVAR.
You Can Change it Easily at #define FLAGS.
if the cvar is 0, the mod won't work, else, it will by send to chat the command
/chat
First Time : Blocking The Chat To Players Without The Flags Level [ADMIN_CVAR]
Second Time : Enables The Chat To All.
Well, The Code is the most important isn't it ?
Big Credit To : ImNativus For Fix Some Bugs.
PHP Code:
#include <amxmodx>
#include <colorchat>
#define FLAGS ADMIN_CVAR
new bool:BlockChat;
new eCvar;
public plugin_init()
{
register_plugin("Block Chat", "V2.0", "Enkore & ImNativus")
register_clcmd("say", "HandleSay");
register_clcmd("say_team", "HandleSay");
eCvar = register_cvar("chatblock_command", "1")
register_clcmd("say /chat", "CmdBlockChat");
}
public CmdBlockChat( client, id )
{
if ( !(get_user_flags( client ) & FLAGS ) && !get_pcvar_num( eCvar ) )
{
ColorChat(id, BLUE, "You Are Not An Administrator With ^1%s ^3Levels Cvar Is Off.", FLAGS)
return PLUGIN_HANDLED;
}
BlockChat = !BlockChat;
new szName[33];
get_user_name(id, szName, sizeof szName - 1)
ColorChat( client, BLUE, "The Administrator ^4[ %s ]^3 Has ^4%s ^3The ^4Chat", szName, BlockChat ? "Close" : "Open" );
return PLUGIN_HANDLED;
}
public HandleSay( client ) {
if(get_user_flags(client) & FLAGS ) {
return PLUGIN_CONTINUE;
}
return BlockChat ?
PLUGIN_HANDLED :
PLUGIN_CONTINUE;
}
Attached Files Get Plugin or Get Source (BlockChat.sma - 1.3 KB)
Wyświetl pełny artykuł