Introduce enum structs to core sm plugins
This commit is contained in:
parent
f465985370
commit
c8f3035cb0
@ -73,8 +73,13 @@ Database hDatabase = null; /** Database connection */
|
||||
int g_sequence = 0; /** Global unique sequence number */
|
||||
int ConnectLock = 0; /** Connect sequence number */
|
||||
int RebuildCachePart[3] = {0}; /** Cache part sequence numbers */
|
||||
int PlayerSeq[MAXPLAYERS+1]; /** Player-specific sequence numbers */
|
||||
bool PlayerAuth[MAXPLAYERS+1]; /** Whether a player has been "pre-authed" */
|
||||
|
||||
enum struct PlayerInfo {
|
||||
int sequencenum; /** Player-specific sequence numbers */
|
||||
bool authed; /** Whether a player has been "pre-authed" */
|
||||
}
|
||||
|
||||
PlayerInfo playerinfo[MAXPLAYERS+1];
|
||||
|
||||
//#define _DEBUG
|
||||
|
||||
@ -88,15 +93,15 @@ public void OnMapEnd()
|
||||
|
||||
public bool OnClientConnect(int client, char[] rejectmsg, int maxlen)
|
||||
{
|
||||
PlayerSeq[client] = 0;
|
||||
PlayerAuth[client] = false;
|
||||
playerinfo[client].sequencenum = 0;
|
||||
playerinfo[client].authed = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
PlayerSeq[client] = 0;
|
||||
PlayerAuth[client] = false;
|
||||
playerinfo[client].sequencenum = 0;
|
||||
playerinfo[client].authed = false;
|
||||
}
|
||||
|
||||
public void OnDatabaseConnect(Database db, const char[] error, any data)
|
||||
@ -193,7 +198,7 @@ public void OnRebuildAdminCache(AdminCachePart part)
|
||||
|
||||
public Action OnClientPreAdminCheck(int client)
|
||||
{
|
||||
PlayerAuth[client] = true;
|
||||
playerinfo[client].authed = true;
|
||||
|
||||
/**
|
||||
* Play nice with other plugins. If there's no database, don't delay the
|
||||
@ -241,7 +246,7 @@ public void OnReceiveUserGroups(Database db, DBResultSet rs, const char[] error,
|
||||
/**
|
||||
* Make sure it's the same client.
|
||||
*/
|
||||
if (PlayerSeq[client] != sequence)
|
||||
if (playerinfo[client].sequencenum != sequence)
|
||||
{
|
||||
delete pk;
|
||||
return;
|
||||
@ -310,7 +315,7 @@ public void OnReceiveUser(Database db, DBResultSet rs, const char[] error, any d
|
||||
* Check if this is the latest result request.
|
||||
*/
|
||||
int sequence = pk.ReadCell();
|
||||
if (PlayerSeq[client] != sequence)
|
||||
if (playerinfo[client].sequencenum != sequence)
|
||||
{
|
||||
/* Discard everything, since we're out of sequence. */
|
||||
delete pk;
|
||||
@ -504,11 +509,11 @@ void FetchUser(Database db, int client)
|
||||
/**
|
||||
* Send the actual query.
|
||||
*/
|
||||
PlayerSeq[client] = ++g_sequence;
|
||||
playerinfo[client].sequencenum = ++g_sequence;
|
||||
|
||||
DataPack pk = new DataPack();
|
||||
pk.WriteCell(client);
|
||||
pk.WriteCell(PlayerSeq[client]);
|
||||
pk.WriteCell(playerinfo[client].sequencenum);
|
||||
pk.WriteString(query);
|
||||
|
||||
#if defined _DEBUG
|
||||
@ -522,7 +527,7 @@ void FetchUsersWeCan(Database db)
|
||||
{
|
||||
for (int i=1; i<=MaxClients; i++)
|
||||
{
|
||||
if (PlayerAuth[i] && GetUserAdmin(i) == INVALID_ADMIN_ID)
|
||||
if (playerinfo[i].authed && GetUserAdmin(i) == INVALID_ADMIN_ID)
|
||||
{
|
||||
FetchUser(db, i);
|
||||
}
|
||||
|
@ -46,11 +46,15 @@ public Plugin myinfo =
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
float g_LastTime[MAXPLAYERS + 1] = {0.0, ...}; /* Last time player used say or say_team */
|
||||
int g_FloodTokens[MAXPLAYERS + 1] = {0, ...}; /* Number of flood tokens player has */
|
||||
enum struct PlayerInfo {
|
||||
float lastTime; /* Last time player used say or say_team */
|
||||
int tokenCount; /* Number of flood tokens player has */
|
||||
}
|
||||
|
||||
PlayerInfo playerinfo[MAXPLAYERS+1];
|
||||
|
||||
ConVar sm_flood_time; /* Handle to sm_flood_time convar */
|
||||
|
||||
float max_chat;
|
||||
public void OnPluginStart()
|
||||
{
|
||||
sm_flood_time = CreateConVar("sm_flood_time", "0.75", "Amount of time allowed between chat messages");
|
||||
@ -58,11 +62,10 @@ public void OnPluginStart()
|
||||
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
g_LastTime[client] = 0.0;
|
||||
g_FloodTokens[client] = 0;
|
||||
playerinfo[client].lastTime = 0.0;
|
||||
playerinfo[client].tokenCount = 0;
|
||||
}
|
||||
|
||||
float max_chat;
|
||||
|
||||
public bool OnClientFloodCheck(int client)
|
||||
{
|
||||
@ -74,10 +77,10 @@ public bool OnClientFloodCheck(int client)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (g_LastTime[client] >= GetGameTime())
|
||||
if (playerinfo[client].lastTime >= GetGameTime())
|
||||
{
|
||||
/* If player has 3 or more flood tokens, block their message */
|
||||
if (g_FloodTokens[client] >= 3)
|
||||
if (playerinfo[client].tokenCount >= 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -97,7 +100,7 @@ public void OnClientFloodResult(int client, bool blocked)
|
||||
float curTime = GetGameTime();
|
||||
float newTime = curTime + max_chat;
|
||||
|
||||
if (g_LastTime[client] >= curTime)
|
||||
if (playerinfo[client].lastTime >= curTime)
|
||||
{
|
||||
/* If the last message was blocked, update their time limit */
|
||||
if (blocked)
|
||||
@ -105,16 +108,16 @@ public void OnClientFloodResult(int client, bool blocked)
|
||||
newTime += 3.0;
|
||||
}
|
||||
/* Add one flood token when player goes over chat time limit */
|
||||
else if (g_FloodTokens[client] < 3)
|
||||
else if (playerinfo[client].tokenCount < 3)
|
||||
{
|
||||
g_FloodTokens[client]++;
|
||||
playerinfo[client].tokenCount++;
|
||||
}
|
||||
}
|
||||
else if (g_FloodTokens[client] > 0)
|
||||
else if (playerinfo[client].tokenCount > 0)
|
||||
{
|
||||
/* Remove one flood token when player chats within time limit (slow decay) */
|
||||
g_FloodTokens[client]--;
|
||||
playerinfo[client].tokenCount--;
|
||||
}
|
||||
|
||||
g_LastTime[client] = newTime;
|
||||
playerinfo[client].lastTime = newTime;
|
||||
}
|
||||
|
@ -50,11 +50,15 @@ public Plugin myinfo =
|
||||
|
||||
TopMenu hTopMenu;
|
||||
|
||||
int g_BanTarget[MAXPLAYERS+1];
|
||||
int g_BanTargetUserId[MAXPLAYERS+1];
|
||||
int g_BanTime[MAXPLAYERS+1];
|
||||
enum struct PlayerInfo {
|
||||
int banTarget;
|
||||
int banTargetUserId;
|
||||
int banTime;
|
||||
int isWaitingForChatReason;
|
||||
}
|
||||
|
||||
PlayerInfo playerinfo[MAXPLAYERS+1];
|
||||
|
||||
bool g_IsWaitingForChatReason[MAXPLAYERS+1];
|
||||
KeyValues g_hKvBanReasons;
|
||||
char g_BanReasonsPath[PLATFORM_MAX_PATH];
|
||||
|
||||
@ -94,7 +98,7 @@ public void OnConfigsExecuted()
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_IsWaitingForChatReason[client] = false;
|
||||
playerinfo[client].isWaitingForChatReason = false;
|
||||
}
|
||||
|
||||
void LoadBanReasons()
|
||||
@ -365,9 +369,9 @@ public Action Command_AbortBan(int client, int args)
|
||||
ReplyToCommand(client, "[SM] %t", "No Access");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
if(g_IsWaitingForChatReason[client])
|
||||
if(playerinfo[client].isWaitingForChatReason)
|
||||
{
|
||||
g_IsWaitingForChatReason[client] = false;
|
||||
playerinfo[client].isWaitingForChatReason = false;
|
||||
ReplyToCommand(client, "[SM] %t", "AbortBan applied successfully");
|
||||
}
|
||||
else
|
||||
@ -380,10 +384,10 @@ public Action Command_AbortBan(int client, int args)
|
||||
|
||||
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
|
||||
{
|
||||
if(g_IsWaitingForChatReason[client])
|
||||
if(playerinfo[client].isWaitingForChatReason)
|
||||
{
|
||||
g_IsWaitingForChatReason[client] = false;
|
||||
PrepareBan(client, g_BanTarget[client], g_BanTime[client], sArgs);
|
||||
playerinfo[client].isWaitingForChatReason = false;
|
||||
PrepareBan(client, playerinfo[client].banTarget, playerinfo[client].banTime, sArgs);
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
void PrepareBan(int client, int target, int time, const char[] reason)
|
||||
{
|
||||
int originalTarget = GetClientOfUserId(g_BanTargetUserId[client]);
|
||||
int originalTarget = GetClientOfUserId(playerinfo[client].banTargetUserId);
|
||||
|
||||
if (originalTarget != target)
|
||||
{
|
||||
@ -106,7 +106,7 @@ void DisplayBanTimeMenu(int client)
|
||||
Menu menu = new Menu(MenuHandler_BanTimeList);
|
||||
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T: %N", "Ban player", client, g_BanTarget[client]);
|
||||
Format(title, sizeof(title), "%T: %N", "Ban player", client, playerinfo[client].banTarget);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
|
||||
@ -126,7 +126,7 @@ void DisplayBanReasonMenu(int client)
|
||||
Menu menu = new Menu(MenuHandler_BanReasonList);
|
||||
|
||||
char title[100];
|
||||
Format(title, sizeof(title), "%T: %N", "Ban reason", client, g_BanTarget[client]);
|
||||
Format(title, sizeof(title), "%T: %N", "Ban reason", client, playerinfo[client].banTarget);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
|
||||
@ -163,7 +163,7 @@ public void AdminMenu_Ban(TopMenu topmenu,
|
||||
int maxlength)
|
||||
{
|
||||
//Reset chat reason first
|
||||
g_IsWaitingForChatReason[param] = false;
|
||||
playerinfo[param].isWaitingForChatReason = false;
|
||||
|
||||
if (action == TopMenuAction_DisplayOption)
|
||||
{
|
||||
@ -193,7 +193,7 @@ public int MenuHandler_BanReasonList(Menu menu, MenuAction action, int param1, i
|
||||
if(param2 == 0)
|
||||
{
|
||||
//Chat reason
|
||||
g_IsWaitingForChatReason[param1] = true;
|
||||
playerinfo[param1].isWaitingForChatReason = true;
|
||||
PrintToChat(param1, "[SM] %t", "Custom ban reason explanation", "sm_abortban");
|
||||
}
|
||||
else
|
||||
@ -202,7 +202,7 @@ public int MenuHandler_BanReasonList(Menu menu, MenuAction action, int param1, i
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
|
||||
PrepareBan(param1, g_BanTarget[param1], g_BanTime[param1], info);
|
||||
PrepareBan(param1, playerinfo[param1].banTarget, playerinfo[param1].banTime, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -238,8 +238,8 @@ public int MenuHandler_BanPlayerList(Menu menu, MenuAction action, int param1, i
|
||||
}
|
||||
else
|
||||
{
|
||||
g_BanTarget[param1] = target;
|
||||
g_BanTargetUserId[param1] = userid;
|
||||
playerinfo[param1].banTarget = target;
|
||||
playerinfo[param1].banTargetUserId = userid;
|
||||
DisplayBanTimeMenu(param1);
|
||||
}
|
||||
}
|
||||
@ -263,7 +263,7 @@ public int MenuHandler_BanTimeList(Menu menu, MenuAction action, int param1, int
|
||||
char info[32];
|
||||
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
g_BanTime[param1] = StringToInt(info);
|
||||
playerinfo[param1].banTime = StringToInt(info);
|
||||
|
||||
DisplayBanReasonMenu(param1);
|
||||
}
|
||||
@ -309,10 +309,9 @@ public Action Command_Ban(int client, int args)
|
||||
Arguments[0] = '\0';
|
||||
}
|
||||
|
||||
playerinfo[client].banTargetUserId = GetClientUserId(target);
|
||||
|
||||
int time = StringToInt(s_time);
|
||||
|
||||
g_BanTargetUserId[client] = GetClientUserId(target);
|
||||
|
||||
PrepareBan(client, target, time, Arguments[len]);
|
||||
|
||||
return Plugin_Handled;
|
||||
|
@ -48,8 +48,13 @@ public Plugin myinfo =
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
bool g_Muted[MAXPLAYERS+1]; // Is the player muted?
|
||||
bool g_Gagged[MAXPLAYERS+1]; // Is the player gagged?
|
||||
enum struct PlayerState {
|
||||
bool isMuted; // Is the player muted?
|
||||
bool isGagged; // Is the player gagged?
|
||||
int gagTarget;
|
||||
}
|
||||
|
||||
PlayerState playerstate[MAXPLAYERS+1];
|
||||
|
||||
ConVar g_Cvar_Deadtalk; // Holds the handle for sm_deadtalk
|
||||
ConVar g_Cvar_Alltalk; // Holds the handle for sv_alltalk
|
||||
@ -57,8 +62,6 @@ bool g_Hooked = false; // Tracks if we've hooked events for deadtalk
|
||||
|
||||
TopMenu hTopMenu;
|
||||
|
||||
int g_GagTarget[MAXPLAYERS+1];
|
||||
|
||||
#include "basecomm/gag.sp"
|
||||
#include "basecomm/natives.sp"
|
||||
#include "basecomm/forwards.sp"
|
||||
@ -141,15 +144,15 @@ public void ConVarChange_Deadtalk(ConVar convar, const char[] oldValue, const ch
|
||||
|
||||
public bool OnClientConnect(int client, char[] rejectmsg, int maxlen)
|
||||
{
|
||||
g_Gagged[client] = false;
|
||||
g_Muted[client] = false;
|
||||
playerstate[client].isGagged = false;
|
||||
playerstate[client].isMuted = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
|
||||
{
|
||||
if (client && g_Gagged[client])
|
||||
if (client && playerstate[client].isGagged)
|
||||
{
|
||||
return Plugin_Stop;
|
||||
}
|
||||
@ -168,7 +171,7 @@ public void ConVarChange_Alltalk(ConVar convar, const char[] oldValue, const cha
|
||||
continue;
|
||||
}
|
||||
|
||||
if (g_Muted[i])
|
||||
if (playerstate[i].isMuted)
|
||||
{
|
||||
SetClientListeningFlags(i, VOICE_MUTED);
|
||||
}
|
||||
@ -199,7 +202,7 @@ public void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Muted[client])
|
||||
if (playerstate[client].isMuted)
|
||||
{
|
||||
SetClientListeningFlags(client, VOICE_MUTED);
|
||||
}
|
||||
@ -218,7 +221,7 @@ public void Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast
|
||||
return;
|
||||
}
|
||||
|
||||
if (g_Muted[client])
|
||||
if (playerstate[client].isMuted)
|
||||
{
|
||||
SetClientListeningFlags(client, VOICE_MUTED);
|
||||
return;
|
||||
|
@ -44,15 +44,14 @@ enum CommType
|
||||
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, g_GagTarget[client]);
|
||||
Format(title, sizeof(title), "%T: %N", "Choose Type", client, target);
|
||||
menu.SetTitle(title);
|
||||
menu.ExitBackButton = true;
|
||||
|
||||
int target = g_GagTarget[client];
|
||||
|
||||
if (!g_Muted[target])
|
||||
|
||||
if (!playerstate[target].isMuted)
|
||||
{
|
||||
AddTranslatedMenuItem(menu, "0", "Mute Player", client);
|
||||
}
|
||||
@ -61,7 +60,7 @@ void DisplayGagTypesMenu(int client)
|
||||
AddTranslatedMenuItem(menu, "1", "UnMute Player", client);
|
||||
}
|
||||
|
||||
if (!g_Gagged[target])
|
||||
if (!playerstate[target].isGagged)
|
||||
{
|
||||
AddTranslatedMenuItem(menu, "2", "Gag Player", client);
|
||||
}
|
||||
@ -70,7 +69,7 @@ void DisplayGagTypesMenu(int client)
|
||||
AddTranslatedMenuItem(menu, "3", "UnGag Player", client);
|
||||
}
|
||||
|
||||
if (!g_Muted[target] || !g_Gagged[target])
|
||||
if (!playerstate[target].isMuted || !playerstate[target].isGagged)
|
||||
{
|
||||
AddTranslatedMenuItem(menu, "4", "Silence Player", client);
|
||||
}
|
||||
@ -151,7 +150,7 @@ public int MenuHandler_GagPlayer(Menu menu, MenuAction action, int param1, int p
|
||||
}
|
||||
else
|
||||
{
|
||||
g_GagTarget[param1] = GetClientOfUserId(userid);
|
||||
playerstate[param1].gagTarget = GetClientOfUserId(userid);
|
||||
DisplayGagTypesMenu(param1);
|
||||
}
|
||||
}
|
||||
@ -178,39 +177,41 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa
|
||||
menu.GetItem(param2, info, sizeof(info));
|
||||
type = view_as<CommType>(StringToInt(info));
|
||||
|
||||
int target = playerstate[param1].gagTarget;
|
||||
|
||||
char name[MAX_NAME_LENGTH];
|
||||
GetClientName(g_GagTarget[param1], name, sizeof(name));
|
||||
GetClientName(target, name, sizeof(name));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CommType_Mute:
|
||||
{
|
||||
PerformMute(param1, g_GagTarget[param1]);
|
||||
PerformMute(param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Muted target", "_s", name);
|
||||
}
|
||||
case CommType_UnMute:
|
||||
{
|
||||
PerformUnMute(param1, g_GagTarget[param1]);
|
||||
PerformUnMute(param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Unmuted target", "_s", name);
|
||||
}
|
||||
case CommType_Gag:
|
||||
{
|
||||
PerformGag(param1, g_GagTarget[param1]);
|
||||
PerformGag(param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Gagged target", "_s", name);
|
||||
}
|
||||
case CommType_UnGag:
|
||||
{
|
||||
PerformUnGag(param1, g_GagTarget[param1]);
|
||||
PerformUnGag(param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Ungagged target", "_s", name);
|
||||
}
|
||||
case CommType_Silence:
|
||||
{
|
||||
PerformSilence(param1, g_GagTarget[param1]);
|
||||
PerformSilence(param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Silenced target", "_s", name);
|
||||
}
|
||||
case CommType_UnSilence:
|
||||
{
|
||||
PerformUnSilence(param1, g_GagTarget[param1]);
|
||||
PerformUnSilence(param1, target);
|
||||
ShowActivity2(param1, "[SM] ", "%t", "Unsilenced target", "_s", name);
|
||||
}
|
||||
}
|
||||
@ -219,7 +220,7 @@ public int MenuHandler_GagTypes(Menu menu, MenuAction action, int param1, int pa
|
||||
|
||||
void PerformMute(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Muted[target] = true;
|
||||
playerstate[target].isMuted = true;
|
||||
SetClientListeningFlags(target, VOICE_MUTED);
|
||||
|
||||
FireOnClientMute(target, true);
|
||||
@ -232,7 +233,7 @@ void PerformMute(int client, int target, bool silent=false)
|
||||
|
||||
void PerformUnMute(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Muted[target] = false;
|
||||
playerstate[target].isMuted = false;
|
||||
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
||||
{
|
||||
SetClientListeningFlags(target, VOICE_LISTENALL);
|
||||
@ -256,7 +257,7 @@ void PerformUnMute(int client, int target, bool silent=false)
|
||||
|
||||
void PerformGag(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Gagged[target] = true;
|
||||
playerstate[target].isGagged = true;
|
||||
FireOnClientGag(target, true);
|
||||
|
||||
if (!silent)
|
||||
@ -267,7 +268,7 @@ void PerformGag(int client, int target, bool silent=false)
|
||||
|
||||
void PerformUnGag(int client, int target, bool silent=false)
|
||||
{
|
||||
g_Gagged[target] = false;
|
||||
playerstate[target].isGagged = false;
|
||||
FireOnClientGag(target, false);
|
||||
|
||||
if (!silent)
|
||||
@ -278,15 +279,15 @@ void PerformUnGag(int client, int target, bool silent=false)
|
||||
|
||||
void PerformSilence(int client, int target)
|
||||
{
|
||||
if (!g_Gagged[target])
|
||||
if (!playerstate[target].isGagged)
|
||||
{
|
||||
g_Gagged[target] = true;
|
||||
playerstate[target].isGagged = true;
|
||||
FireOnClientGag(target, true);
|
||||
}
|
||||
|
||||
if (!g_Muted[target])
|
||||
if (!playerstate[target].isMuted)
|
||||
{
|
||||
g_Muted[target] = true;
|
||||
playerstate[target].isMuted = true;
|
||||
SetClientListeningFlags(target, VOICE_MUTED);
|
||||
FireOnClientMute(target, true);
|
||||
}
|
||||
@ -296,15 +297,15 @@ void PerformSilence(int client, int target)
|
||||
|
||||
void PerformUnSilence(int client, int target)
|
||||
{
|
||||
if (g_Gagged[target])
|
||||
if (playerstate[target].isGagged)
|
||||
{
|
||||
g_Gagged[target] = false;
|
||||
playerstate[target].isGagged = false;
|
||||
FireOnClientGag(target, false);
|
||||
}
|
||||
|
||||
if (g_Muted[target])
|
||||
if (playerstate[target].isMuted)
|
||||
{
|
||||
g_Muted[target] = false;
|
||||
playerstate[target].isMuted = false;
|
||||
|
||||
if (g_Cvar_Deadtalk.IntValue == 1 && !IsPlayerAlive(target))
|
||||
{
|
||||
@ -501,7 +502,7 @@ public Action Command_Unmute(int client, int args)
|
||||
{
|
||||
int target = target_list[i];
|
||||
|
||||
if (!g_Muted[target])
|
||||
if (!playerstate[target].isMuted)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
|
||||
}
|
||||
|
||||
return g_Gagged[client];
|
||||
return playerstate[client].isGagged;
|
||||
}
|
||||
|
||||
public int Native_IsClientMuted(Handle hPlugin, int numParams)
|
||||
@ -60,7 +60,7 @@ public int Native_IsClientMuted(Handle hPlugin, int numParams)
|
||||
return ThrowNativeError(SP_ERROR_NATIVE, "Client %d is not in game", client);
|
||||
}
|
||||
|
||||
return g_Muted[client];
|
||||
return playerstate[client].isMuted;
|
||||
}
|
||||
|
||||
public int Native_SetClientGag(Handle hPlugin, int numParams)
|
||||
@ -80,7 +80,7 @@ public int Native_SetClientGag(Handle hPlugin, int numParams)
|
||||
|
||||
if (gagState)
|
||||
{
|
||||
if (g_Gagged[client])
|
||||
if (playerstate[client].isGagged)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -89,7 +89,7 @@ public int Native_SetClientGag(Handle hPlugin, int numParams)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_Gagged[client])
|
||||
if (!playerstate[client].isGagged)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -117,7 +117,7 @@ public int Native_SetClientMute(Handle hPlugin, int numParams)
|
||||
|
||||
if (muteState)
|
||||
{
|
||||
if (g_Muted[client])
|
||||
if (playerstate[client].isMuted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -126,7 +126,7 @@ public int Native_SetClientMute(Handle hPlugin, int numParams)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!g_Muted[client])
|
||||
if (!playerstate[client].isMuted)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user