Code:
/* AMXMODX script.
*
* Made by: Infra
* Current Version: 2.0
*
* This file is provided as is (no warranties).
*
* -=[ AMX Clan Chat ]=-
*
* Cvars:
* ---------
*
* amx_cc_clan -> contains your clan's name
*
*
* Usage:
* ---------
*
* Console commands:
*
* amx_clanchat <message>
*
* and
*
* clanChat <message>
*
* Also (Team Chat):
*
* say_team "^<message>"
*
* Or in team chat:
*
* ^<message>
*
* Also (optional):
*
* Tell all of your clanmates, even those who can't have admin chat, to bind a key to:
*
* "messagemode clanChat"
*
* Like so:
*
* bind "<key>" "messagemode clanChat"
*
* Note: Make sure to change the amx_cc_clan cvar to the name of your clan
* your clan (including tags if you wish...)
*
* For instance, my clans name is [CI]. So, I make the cvar this:
*
* amx_cvar amx_cc_clan "CI"
*
*
* Or to make it permanent, add this line to your amxx.cfg file:
*
* amx_cc_clan "CI"
*
* Changelog:
* ---------
*
* 2.0: Fixed bug where clanChat messages would be displayed to all players
* Revamped plugin to conform to command format in the adminchat plugin
* 1.1: Added cvar for clan tag
* 1.0: First release
*
* Todo:
* ---------
*
* None
*
*
*/
#include <amxmodx>
#include <amxmisc>
public clanChat( id )
{
new players[32], numPlayers
new message[192]
new authid[16], name[32]
new clanName[32]
// Get user's name
get_user_name(id, name, 31)
// Get message and remove quotes
read_args(message, 191)
remove_quotes(message)
// Get players currently on server
get_players(players, numPlayers)
// Get Clan Name
get_cvar_string("amx_cc_clan", clanName, 31)
// (ADMINS) [CI]MooMooJr. : yay
format(message, 192, "(%s) %s : %s", clanName, name, message)
for(new i = 0; i < numPlayers; i++)
{
// If user has access, then print message for them
if( access(players[i], ADMIN_LEVEL_D) )
{
client_print(players[i], print_chat, message)
}
}
get_user_authid(id, authid, 15)
log_amx("Chat: ^"%s<%d><%s><>^" clan chat ^"%s^"",name, id, authid, message)
log_message("^"%s<%d><%s><>^" triggered ^"amx_clanchat^" (text ^"%s^")",name, id, authid, message)
return PLUGIN_CONTINUE
}
public commandChat ( id,level,cid )
{
if(!cmd_access(id,level,cid,2))
{
return PLUGIN_CONTINUE
}
new message[2]
read_argv(1,message,1)
if (message[0]!= '^^')
{
return PLUGIN_CONTINUE
}
clanChat( id )
return PLUGIN_CONTINUE
}
public commandConsole ( id,level,cid )
{
if(!cmd_access(id,level,cid,2))
{
return PLUGIN_HANDLED
}
clanChat( id )
return PLUGIN_HANDLED
}
public plugin_init()
{
register_plugin("AMX Clan Chat", "2.0", "Infra")
register_cvar("amx_clan_chat", "2.0", FCVAR_SERVER)
// Console commands
register_concmd("clanChat","commandConsole",ADMIN_LEVEL_D,"<message>")
register_concmd("amx_clanchat","commandConsole",ADMIN_LEVEL_D,"<message>")
// Client commands
register_clcmd("say_team","commandChat",ADMIN_LEVEL_D,"^^<message> - displays message to clan members")
// Cvars
register_cvar("amx_cc_clan","<clan>")
return PLUGIN_CONTINUE
}