Ok. I got it. Here is how you can get it working "WITHOUT" giving your players admin abilities.
however, you will need to give each clan member a flag, the flags you need to give them are "nz". With those two flags,they will be able to view the clan chat, and reply within the clan chat, but not view admin chat or perform any admin commands. You MUST have the z at the end, or they will be able to view the admin chat.
Use the below code:
Code:
#include <amxmodx>
#include <amxmisc>
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_B,"<message>")
register_concmd("amx_clanchat","commandConsole",ADMIN_LEVEL_B,"<message>")
// Client commands
register_clcmd("clanChat","commandChat",ADMIN_LEVEL_B,"<message> - displays message to clan members")
// Cvars
register_cvar("amx_cc_clan","<clanname>")
return PLUGIN_CONTINUE
}
public clanChat( id )
{
new players[32], numPlayers
new message[192]
new authid[16], name[32]
new clanName[32]
// Get message and remove quotes
read_args(message, 191)
remove_quotes(message)
// Get user's name
get_user_name(id, name, 31)
// Get players currently on server
get_players(players, numPlayers)
// Get Clan Name
get_cvar_string("amx_cc_clan", clanName, 31)
// (ADMINS) [CI]MooMooJr. : yay
// Declare Clan Permission
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
/*All clan members must have the flag nz to use this, it will void all admin access, but will allow them to view the clan message.*/
if( access(players[i], ADMIN_LEVEL_B) )
{
client_print(players[i], print_chat, message)
}
}
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_HANDLED
}
public commandConsole ( id,level,cid )
{
if(!cmd_access(id,level,cid,2))
{
return PLUGIN_CONTINUE
}
clanChat( id )
return PLUGIN_HANDLED
}
This is only a temporary fix until i can get my amxx team working with it and make a fix.
Also I advise them to bind it to a key as follows: bind "i" "messagemode clanChat"