Port basecomm.sp.

This commit is contained in:
David Anderson 2014-11-09 16:35:52 -08:00
parent fb5b552f86
commit 4a14b776db

View File

@ -50,8 +50,8 @@ public Plugin:myinfo =
new bool:g_Muted[MAXPLAYERS+1]; // Is the player muted?
new bool:g_Gagged[MAXPLAYERS+1]; // Is the player gagged?
new Handle:g_Cvar_Deadtalk = INVALID_HANDLE; // Holds the handle for sm_deadtalk
new Handle:g_Cvar_Alltalk = INVALID_HANDLE; // Holds the handle for sv_alltalk
ConVar g_Cvar_Deadtalk; // Holds the handle for sm_deadtalk
ConVar g_Cvar_Alltalk; // Holds the handle for sv_alltalk
new bool:g_Hooked = false; // Tracks if we've hooked events for deadtalk
TopMenu hTopMenu;
@ -89,8 +89,8 @@ public OnPluginStart()
RegAdminCmd("sm_ungag", Command_Ungag, ADMFLAG_CHAT, "sm_ungag <player> - Restores a player's ability to use chat.");
RegAdminCmd("sm_unsilence", Command_Unsilence, ADMFLAG_CHAT, "sm_unsilence <player> - Restores a player's ability to use voice and chat.");
HookConVarChange(g_Cvar_Deadtalk, ConVarChange_Deadtalk);
HookConVarChange(g_Cvar_Alltalk, ConVarChange_Alltalk);
g_Cvar_Deadtalk.AddChangeHook(ConVarChange_Deadtalk);
g_Cvar_Alltalk.AddChangeHook(ConVarChange_Alltalk);
/* Account for late loading */
TopMenu topmenu;
@ -122,7 +122,7 @@ public OnAdminMenuReady(TopMenu topmenu)
public ConVarChange_Deadtalk(Handle:convar, const String:oldValue[], const String:newValue[])
{
if (GetConVarInt(g_Cvar_Deadtalk))
if (g_Cvar_Deadtalk.IntValue)
{
HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_Post);
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post);
@ -155,11 +155,11 @@ public Action:OnClientSayCommand(client, const String:command[], const String:sA
return Plugin_Continue;
}
public ConVarChange_Alltalk(Handle:convar, const String:oldValue[], const String:newValue[])
public void ConVarChange_Alltalk(ConVar convar, const char[] oldValue, const char[] newValue)
{
new mode = GetConVarInt(g_Cvar_Deadtalk);
int mode = g_Cvar_Deadtalk.IntValue;
for (new i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
if (!IsClientInGame(i))
{
@ -170,7 +170,7 @@ public ConVarChange_Alltalk(Handle:convar, const String:oldValue[], const String
{
SetClientListeningFlags(i, VOICE_MUTED);
}
else if (GetConVarBool(g_Cvar_Alltalk))
else if (g_Cvar_Alltalk.BoolValue)
{
SetClientListeningFlags(i, VOICE_NORMAL);
}
@ -209,7 +209,7 @@ public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if (!client)
{
@ -222,13 +222,13 @@ public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
return;
}
if (GetConVarBool(g_Cvar_Alltalk))
if (g_Cvar_Alltalk.BoolValue)
{
SetClientListeningFlags(client, VOICE_NORMAL);
return;
}
new mode = GetConVarInt(g_Cvar_Deadtalk);
int mode = g_Cvar_Deadtalk.IntValue;
if (mode == 1)
{
SetClientListeningFlags(client, VOICE_LISTENALL);