Logging changes to various base plugins.
This commit is contained in:
+121
-127
@@ -10,7 +10,7 @@
|
||||
* This program is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, version 3.0, as published by the
|
||||
* Free Software Foundation.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
@@ -45,7 +45,7 @@ void DisplayGagTypesMenu(int client)
|
||||
{
|
||||
Menu menu = new Menu(MenuHandler_GagTypes);
|
||||
int target = playerstate[client].gagTarget;
|
||||
|
||||
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T: %N", "Choose Type", client, target);
|
||||
menu.SetTitle(title);
|
||||
@@ -65,7 +65,7 @@ void DisplayGagTypesMenu(int client)
|
||||
AddTranslatedMenuItem(menu, "1", "UnMute Player", client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!playerstate[target].isGagged)
|
||||
{
|
||||
if(CheckCommandAccess(client, "sm_gag", ADMFLAG_CHAT, false))
|
||||
@@ -80,7 +80,7 @@ void DisplayGagTypesMenu(int client)
|
||||
AddTranslatedMenuItem(menu, "3", "UnGag Player", client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!playerstate[target].isMuted || !playerstate[target].isGagged)
|
||||
{
|
||||
if(CheckCommandAccess(client, "sm_silence", ADMFLAG_CHAT, false))
|
||||
@@ -95,7 +95,7 @@ void DisplayGagTypesMenu(int client)
|
||||
AddTranslatedMenuItem(menu, "5", "UnSilence Player", client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
@@ -109,18 +109,18 @@ void AddTranslatedMenuItem(Menu menu, const char[] opt, const char[] phrase, int
|
||||
void DisplayGagPlayerMenu(int client)
|
||||
{
|
||||
Menu menu = new Menu(MenuHandler_GagPlayer);
|
||||
|
||||
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T:", "Gag/Mute player", client);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
|
||||
|
||||
AddTargetsToMenu(menu, client, true, false);
|
||||
|
||||
|
||||
menu.Display(client, MENU_TIME_FOREVER);
|
||||
}
|
||||
|
||||
public void AdminMenu_Gag(TopMenu topmenu,
|
||||
public void AdminMenu_Gag(TopMenu topmenu,
|
||||
TopMenuAction action,
|
||||
TopMenuObject object_id,
|
||||
int param,
|
||||
@@ -154,7 +154,7 @@ public int MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int p
|
||||
{
|
||||
char info[32];
|
||||
int userid, target;
|
||||
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
userid = StringToInt(info);
|
||||
|
||||
@@ -193,12 +193,12 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa
|
||||
{
|
||||
char info[32];
|
||||
CommType type;
|
||||
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
type = view_as<CommType>(StringToInt(info));
|
||||
|
||||
|
||||
int target = playerstate[param1].gagTarget;
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH];
|
||||
GetClientName(target, name, sizeof(name));
|
||||
|
||||
@@ -207,42 +207,48 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa
|
||||
case CommType_Mute:
|
||||
{
|
||||
if(CheckCommandAccess(param1, "sm_mute", ADMFLAG_CHAT, false)){
|
||||
PerformMute(param1, target);
|
||||
PerformMute(target);
|
||||
LogAction(param1, target, "\"%L\" muted \"%L\"", param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
|
||||
}
|
||||
}
|
||||
case CommType_UnMute:
|
||||
{
|
||||
if(CheckCommandAccess(param1, "sm_unmute", ADMFLAG_CHAT, false)){
|
||||
PerformUnMute(param1, target);
|
||||
PerformUnMute(target);
|
||||
LogAction(param1, target, "\"%L\" unmuted \"%L\"", param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
|
||||
}
|
||||
}
|
||||
case CommType_Gag:
|
||||
{
|
||||
if(CheckCommandAccess(param1, "sm_gag", ADMFLAG_CHAT, false)){
|
||||
PerformGag(param1, target);
|
||||
PerformGag(target);
|
||||
LogAction(param1, target, "\"%L\" gagged \"%L\"", param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
|
||||
}
|
||||
}
|
||||
case CommType_UnGag:
|
||||
{
|
||||
if(CheckCommandAccess(param1, "sm_ungag", ADMFLAG_CHAT, false)){
|
||||
PerformUnGag(param1, target);
|
||||
PerformUnGag(target);
|
||||
LogAction(param1, target, "\"%L\" ungagged \"%L\"", param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
|
||||
}
|
||||
}
|
||||
case CommType_Silence:
|
||||
{
|
||||
if(CheckCommandAccess(param1, "sm_silence", ADMFLAG_CHAT, false)){
|
||||
PerformSilence(param1, target);
|
||||
PerformSilence(target);
|
||||
LogAction(param1, target, "\"%L\" silenced \"%L\"", param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
|
||||
}
|
||||
}
|
||||
case CommType_UnSilence:
|
||||
{
|
||||
if(CheckCommandAccess(param1, "sm_unsilence", ADMFLAG_CHAT, false)){
|
||||
PerformUnSilence(param1, target);
|
||||
PerformUnSilence(target);
|
||||
LogAction(param1, target, "\"%L\" unsilenced \"%L\"", param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
|
||||
}
|
||||
}
|
||||
@@ -252,20 +258,15 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa
|
||||
return 0;
|
||||
}
|
||||
|
||||
void PerformMute(int client, int target, bool silent=false)
|
||||
void PerformMute(int target)
|
||||
{
|
||||
playerstate[target].isMuted = true;
|
||||
SetClientListeningFlags(target, VOICE_MUTED);
|
||||
|
||||
|
||||
FireOnClientMute(target, true);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
|
||||
}
|
||||
}
|
||||
|
||||
void PerformUnMute(int client, int target, bool silent=false)
|
||||
void PerformUnMute(int target)
|
||||
{
|
||||
playerstate[target].isMuted = false;
|
||||
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
||||
@@ -280,67 +281,50 @@ void PerformUnMute(int client, int target, bool silent=false)
|
||||
{
|
||||
SetClientListeningFlags(target, VOICE_NORMAL);
|
||||
}
|
||||
|
||||
|
||||
FireOnClientMute(target, false);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
|
||||
}
|
||||
}
|
||||
|
||||
void PerformGag(int client, int target, bool silent=false)
|
||||
void PerformGag(int target)
|
||||
{
|
||||
playerstate[target].isGagged = true;
|
||||
FireOnClientGag(target, true);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
|
||||
}
|
||||
}
|
||||
|
||||
void PerformUnGag(int client, int target, bool silent=false)
|
||||
void PerformUnGag(int target)
|
||||
{
|
||||
playerstate[target].isGagged = false;
|
||||
FireOnClientGag(target, false);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
|
||||
}
|
||||
}
|
||||
|
||||
void PerformSilence(int client, int target)
|
||||
void PerformSilence(int target)
|
||||
{
|
||||
if (!playerstate[target].isGagged)
|
||||
{
|
||||
playerstate[target].isGagged = true;
|
||||
FireOnClientGag(target, true);
|
||||
}
|
||||
|
||||
|
||||
if (!playerstate[target].isMuted)
|
||||
{
|
||||
playerstate[target].isMuted = true;
|
||||
SetClientListeningFlags(target, VOICE_MUTED);
|
||||
FireOnClientMute(target, true);
|
||||
}
|
||||
|
||||
LogAction(client, target, "\"%L\" silenced \"%L\"", client, target);
|
||||
}
|
||||
|
||||
void PerformUnSilence(int client, int target)
|
||||
void PerformUnSilence(int target)
|
||||
{
|
||||
if (playerstate[target].isGagged)
|
||||
{
|
||||
playerstate[target].isGagged = false;
|
||||
FireOnClientGag(target, false);
|
||||
}
|
||||
|
||||
|
||||
if (playerstate[target].isMuted)
|
||||
{
|
||||
playerstate[target].isMuted = false;
|
||||
|
||||
|
||||
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
||||
{
|
||||
SetClientListeningFlags(target, VOICE_LISTENALL);
|
||||
@@ -355,30 +339,28 @@ void PerformUnSilence(int client, int target)
|
||||
}
|
||||
FireOnClientMute(target, false);
|
||||
}
|
||||
|
||||
LogAction(client, target, "\"%L\" unsilenced \"%L\"", client, target);
|
||||
}
|
||||
|
||||
public Action Command_Mute(int client, int args)
|
||||
{
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_mute <player>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
0,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
@@ -391,42 +373,44 @@ public Action Command_Mute(int client, int args)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
PerformMute(client, target);
|
||||
|
||||
PerformMute(target);
|
||||
}
|
||||
|
||||
|
||||
if (tn_is_ml)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Muted target", target_name);
|
||||
LogAction(client, -1, "\"%L\" muted \"%s\"", client, target_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Muted target", "_s", target_name);
|
||||
LogAction(client, target_list[0], "\"%L\" muted \"%L\"", client, target_list[0]);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Gag(int client, int args)
|
||||
{
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_gag <player>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
0,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
@@ -439,42 +423,44 @@ public Action Command_Gag(int client, int args)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
PerformGag(client, target);
|
||||
|
||||
PerformGag(target);
|
||||
}
|
||||
|
||||
|
||||
if (tn_is_ml)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Gagged target", target_name);
|
||||
LogAction(client, -1, "\"%L\" gagged \"%s\"", client, target_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Gagged target", "_s", target_name);
|
||||
LogAction(client, target_list[0], "\"%L\" gagged \"%L\"", client, target_list[0]);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Silence(int client, int args)
|
||||
{
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_silence <player>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
0,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
@@ -487,42 +473,44 @@ public Action Command_Silence(int client, int args)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
PerformSilence(client, target);
|
||||
|
||||
PerformSilence(target);
|
||||
}
|
||||
|
||||
|
||||
if (tn_is_ml)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Silenced target", target_name);
|
||||
LogAction(client, -1, "\"%L\" silenced \"%s\"", client, target_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Silenced target", "_s", target_name);
|
||||
LogAction(client, target_list[0], "\"%L\" silenced \"%L\"", client, target_list[0]);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Unmute(int client, int args)
|
||||
{
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_unmute <player>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
0,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
@@ -535,15 +523,17 @@ public Action Command_Unmute(int client, int args)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
|
||||
if (!playerstate[target].isMuted)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
PerformUnMute(client, target);
|
||||
|
||||
PerformUnMute(target);
|
||||
}
|
||||
|
||||
|
||||
LogAction(client, -1, "\"%L\" unmuted \"%s\"", client, target_name);
|
||||
|
||||
if (tn_is_ml)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Unmuted target", target_name);
|
||||
@@ -552,30 +542,30 @@ public Action Command_Unmute(int client, int args)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Unmuted target", "_s", target_name);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Ungag(int client, int args)
|
||||
{
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_ungag <player>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
0,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
@@ -588,42 +578,44 @@ public Action Command_Ungag(int client, int args)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
PerformUnGag(client, target);
|
||||
|
||||
PerformUnGag(target);
|
||||
}
|
||||
|
||||
|
||||
if (tn_is_ml)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", target_name);
|
||||
LogAction(client, -1, "\"%L\" ungagged \"%s\"", client, target_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Ungagged target", "_s", target_name);
|
||||
LogAction(client, target_list[0], "\"%L\" ungagged \"%L\"", client, target_list[0]);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_Unsilence(int client, int args)
|
||||
{
|
||||
{
|
||||
if (args < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_unsilence <player>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
|
||||
char arg[64];
|
||||
GetCmdArg(1, arg, sizeof(arg));
|
||||
|
||||
|
||||
char target_name[MAX_TARGET_LENGTH];
|
||||
int target_list[MAXPLAYERS], target_count;
|
||||
bool tn_is_ml;
|
||||
|
||||
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
client,
|
||||
target_list,
|
||||
MAXPLAYERS,
|
||||
0,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
@@ -636,18 +628,20 @@ public Action Command_Unsilence(int client, int args)
|
||||
for (int i = 0; i < target_count; i++)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
PerformUnSilence(client, target);
|
||||
|
||||
PerformUnSilence(target);
|
||||
}
|
||||
|
||||
|
||||
if (tn_is_ml)
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", target_name);
|
||||
LogAction(client, -1, "\"%L\" unsilenced \"%s\"", client, target_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowActivity2(client, "[SM] ", "%t", "Unsilenced target", "_s", target_name);
|
||||
LogAction(client, target_list[0], "\"%L\" unsilenced \"%L\"", client, target_list[0]);
|
||||
}
|
||||
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public int Native_SetClientGag(Handle hPlugin, int numParams)
|
||||
return false;
|
||||
}
|
||||
|
||||
PerformGag(-1, client, true);
|
||||
PerformGag(client);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public int Native_SetClientGag(Handle hPlugin, int numParams)
|
||||
return false;
|
||||
}
|
||||
|
||||
PerformUnGag(-1, client, true);
|
||||
PerformUnGag(client);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -122,7 +122,7 @@ public int Native_SetClientMute(Handle hPlugin, int numParams)
|
||||
return false;
|
||||
}
|
||||
|
||||
PerformMute(-1, client, true);
|
||||
PerformMute(client);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -131,7 +131,7 @@ public int Native_SetClientMute(Handle hPlugin, int numParams)
|
||||
return false;
|
||||
}
|
||||
|
||||
PerformUnMute(-1, client, true);
|
||||
PerformUnMute(client);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user