Fixed permissions for Basechat say aliases, removed sm_psay_mode. Use command overrides for sm_psay instead.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401712
This commit is contained in:
Michael McKoy 2007-11-21 01:21:32 +00:00
parent 09b6c5ead1
commit 58ff2d14af
2 changed files with 5 additions and 24 deletions

View File

@ -93,13 +93,6 @@ sm_hide_slots 0
// Default: 1 // Default: 1
sm_chat_mode 1 sm_chat_mode 1
// Specifies whether or not non-admins can send private messages to each other
// using say @@<target> <message>. Valid values are 0 (disabled) or 1 (enabled)
// --
// Required: basechat.smx
// Default: 1
sm_psay_mode 0
// Specifies whether or not "timeleft" will automaticly be triggered every // Specifies whether or not "timeleft" will automaticly be triggered every
// x seconds. Valid values are 0 (disabled) to 1800 seconds. // x seconds. Valid values are 0 (disabled) to 1800 seconds.
// -- // --

View File

@ -50,7 +50,6 @@ new String:g_ColorNames[13][10] = {"White", "Red", "Green", "Blue", "Yellow", "P
new g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255},{255,128,0},{255,0,128},{128,255,0},{0,255,128},{128,0,255},{0,128,255}}; new g_Colors[13][3] = {{255,255,255},{255,0,0},{0,255,0},{0,0,255},{255,255,0},{255,0,255},{0,255,255},{255,128,0},{255,0,128},{128,255,0},{0,255,128},{128,0,255},{0,128,255}};
new Handle:g_Cvar_Chatmode = INVALID_HANDLE; new Handle:g_Cvar_Chatmode = INVALID_HANDLE;
new Handle:g_Cvar_Psaymode = INVALID_HANDLE;
new bool:g_DoColor = true; new bool:g_DoColor = true;
@ -59,7 +58,6 @@ public OnPluginStart()
LoadTranslations("common.phrases"); LoadTranslations("common.phrases");
g_Cvar_Chatmode = CreateConVar("sm_chat_mode", "1", "Allows player's to send messages to admin chat.", 0, true, 0.0, true, 1.0); g_Cvar_Chatmode = CreateConVar("sm_chat_mode", "1", "Allows player's to send messages to admin chat.", 0, true, 0.0, true, 1.0);
g_Cvar_Psaymode = CreateConVar("sm_psay_mode", "0", "Allows player's to use psay 'say @@' alias.", 0, true, 0.0, true, 1.0);
RegConsoleCmd("say", Command_SayChat); RegConsoleCmd("say", Command_SayChat);
RegConsoleCmd("say_team", Command_SayAdmin); RegConsoleCmd("say_team", Command_SayAdmin);
@ -114,17 +112,17 @@ public Action:Command_SayChat(client, args)
decl String:name[64]; decl String:name[64];
GetClientName(client, name, sizeof(name)); GetClientName(client, name, sizeof(name));
if (msgStart == 1 && CheckAdminForChat(client)) // sm_say alias if (msgStart == 1 && CheckCommandAccess(client, "sm_say", ADMFLAG_CHAT)) // sm_say alias
{ {
SendChatToAll(name, message); SendChatToAll(name, message);
LogAction(client, -1, "%L triggered sm_say (text %s)", client, message); LogAction(client, -1, "%L triggered sm_say (text %s)", client, message);
} }
else if (msgStart == 3 && CheckAdminForChat(client)) // sm_csay alias else if (msgStart == 3 && CheckCommandAccess(client, "sm_csay", ADMFLAG_CHAT)) // sm_csay alias
{ {
PrintCenterTextAll("%s: %s", name, message); PrintCenterTextAll("%s: %s", name, message);
LogAction(client, -1, "%L triggered sm_csay (text %s)", client, text); LogAction(client, -1, "%L triggered sm_csay (text %s)", client, text);
} }
else if (msgStart == 2 && (CheckAdminForChat(client) || GetConVarBool(g_Cvar_Psaymode))) // sm_psay alias else if (msgStart == 2 && CheckCommandAccess(client, "sm_psay", ADMFLAG_CHAT)) // sm_psay alias
{ {
decl String:arg[64]; decl String:arg[64];
@ -158,7 +156,7 @@ public Action:Command_SayChat(client, args)
public Action:Command_SayAdmin(client, args) public Action:Command_SayAdmin(client, args)
{ {
if (!CheckAdminForChat(client) && !GetConVarBool(g_Cvar_Chatmode)) if (!CheckCommandAccess(client, "sm_chat", ADMFLAG_CHAT) && !GetConVarBool(g_Cvar_Chatmode))
{ {
return Plugin_Continue; return Plugin_Continue;
} }
@ -359,16 +357,6 @@ public Action:Command_SmMsay(client, args)
return Plugin_Handled; return Plugin_Handled;
} }
bool:CheckAdminForChat(client)
{
if (client == 0)
{
return true;
}
return CheckCommandAccess(client, "sm_chat", ADMFLAG_CHAT);
}
FindColor(String:color[]) FindColor(String:color[])
{ {
for (new i = 0; i < 13; i++) for (new i = 0; i < 13; i++)
@ -400,7 +388,7 @@ SendChatToAdmins(String:name[], String:message[])
{ {
if (IsClientInGame(i)) if (IsClientInGame(i))
{ {
if (CheckAdminForChat(i)) if (CheckCommandAccess(i, "sm_chat", ADMFLAG_CHAT))
{ {
if (g_DoColor) if (g_DoColor)
{ {