Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
Untitled Diff
Creato
6 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
11 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
248 linee
Copia tutti
10 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
248 linee
Copia tutti
#pragma semicolon 1
#pragma semicolon 1
#pragma newdecls required
#pragma newdecls required
#include <sourcemod>
#include <sourcemod>
#include <clientprefs>
#include <clientprefs>
#include <sdktools>
#include <sdktools>
#include <sdkhooks>
#include <sdkhooks>
#include <cstrike>
#include <cstrike>
#define SPECMODE_NONE 0
#define SPECMODE_NONE 0
#define SPECMODE_FIRSTPERSON 4
#define SPECMODE_FIRSTPERSON 4
#define SPECMODE_3RDPERSON 5
#define SPECMODE_3RDPERSON 5
#define SPECMODE_FREELOOK 6
#define SPECMODE_FREELOOK 6
#define UPDATE_INTERVAL 2.5
#define UPDATE_INTERVAL 2.5
Handle HudHintTimers[MAXPLAYERS + 1];
Handle HudHintTimers[MAXPLAYERS + 1];
bool speclist_stealth[MAXPLAYERS + 1];
bool speclist_stealth[MAXPLAYERS + 1];
bool speclist_enabled[MAXPLAYERS + 1];
bool speclist_enabled[MAXPLAYERS + 1];
Handle g_cEnabled = null;
Handle g_cEnabled = null;
public Plugin myinfo =
public Plugin myinfo =
{
{
Copia
Copiato
Copia
Copiato
name = "SpecList
",
name = "SpecList
/Fix
",
author = "cra88y
",
author = "cra88y
/Timid
",
version = "
6.9
",
version = "
7.1
",
};
};
public void OnPluginStart()
public void OnPluginStart()
{
{
RegConsoleCmd("sm_speclist", Command_SpecList);
RegConsoleCmd("sm_speclist", Command_SpecList);
RegAdminCmd("sm_stealth", Command_Stealth, ADMFLAG_ROOT);
RegAdminCmd("sm_stealth", Command_Stealth, ADMFLAG_ROOT);
g_cEnabled = RegClientCookie("Speclist_Enabled", "Speclist on or off", CookieAccess_Protected);
g_cEnabled = RegClientCookie("Speclist_Enabled", "Speclist on or off", CookieAccess_Protected);
HookEvent("player_spawn", Event_Player_Spawn);
HookEvent("player_spawn", Event_Player_Spawn);
for (int i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
{
if (IsClientConnected(i) && IsValidClient(i) && AreClientCookiesCached(i))
if (IsClientConnected(i) && IsValidClient(i) && AreClientCookiesCached(i))
{
{
OnClientCookiesCached(i);
OnClientCookiesCached(i);
}
}
}
}
}
}
public void OnClientPostAdminCheck(int client)
public void OnClientPostAdminCheck(int client)
{
{
CreateHudHintTimer(client);
CreateHudHintTimer(client);
speclist_enabled[client] = true;
speclist_enabled[client] = true;
speclist_stealth[client] = false;
speclist_stealth[client] = false;
}
}
public void OnClientDisconnect(int client)
public void OnClientDisconnect(int client)
{
{
if (IsClientInGame(client))
if (IsClientInGame(client))
KillHudHintTimer(client);
KillHudHintTimer(client);
}
}
public void OnClientCookiesCached(int client)
public void OnClientCookiesCached(int client)
{
{
char CookieEnabled[16];
char CookieEnabled[16];
GetClientCookie(client, g_cEnabled, CookieEnabled, sizeof(CookieEnabled));
GetClientCookie(client, g_cEnabled, CookieEnabled, sizeof(CookieEnabled));
speclist_enabled[client] = CookieEnabled[0] == '\0' ? true : view_as<bool>(StringToInt(CookieEnabled));
speclist_enabled[client] = CookieEnabled[0] == '\0' ? true : view_as<bool>(StringToInt(CookieEnabled));
if (!speclist_enabled[client])
if (!speclist_enabled[client])
{
{
KillHudHintTimer(client);
KillHudHintTimer(client);
}
}
/*if (g_iSpecEnabled[client] == 1)
/*if (g_iSpecEnabled[client] == 1)
{
{
speclist_enabled[client] = true;
speclist_enabled[client] = true;
}
}
else
else
{
{
speclist_enabled[client] = false;
speclist_enabled[client] = false;
KillHudHintTimer(client);
KillHudHintTimer(client);
}*/
}*/
}
}
public Action Event_Player_Spawn(Event event, const char[] name, bool dontBroadcast)
public Action Event_Player_Spawn(Event event, const char[] name, bool dontBroadcast)
{
{
int client = GetClientOfUserId(GetEventInt(event, "userid"));
int client = GetClientOfUserId(GetEventInt(event, "userid"));
if (IsClientConnected(client) && IsValidClient(client) && !AreClientCookiesCached(client))
if (IsClientConnected(client) && IsValidClient(client) && !AreClientCookiesCached(client))
{
{
OnClientCookiesCached(client);
OnClientCookiesCached(client);
}
}
}
}
public Action Command_Stealth(int client, int args)
public Action Command_Stealth(int client, int args)
{
{
speclist_stealth[client] = !speclist_stealth[client];
speclist_stealth[client] = !speclist_stealth[client];
if (speclist_stealth[client] == true)
if (speclist_stealth[client] == true)
ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be hidden from speclist.");
ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be hidden from speclist.");
if (speclist_stealth[client] == false)
if (speclist_stealth[client] == false)
ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be shown on speclist.");
ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be shown on speclist.");
}
}
public Action Command_SpecList(int client, int args)
public Action Command_SpecList(int client, int args)
{
{
if (speclist_enabled[client] == true)
if (speclist_enabled[client] == true)
{
{
speclist_enabled[client] = false;
speclist_enabled[client] = false;
KillHudHintTimer(client);
KillHudHintTimer(client);
ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list disabled.");
ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list disabled.");
SetClientCookie(client, g_cEnabled, "0");
SetClientCookie(client, g_cEnabled, "0");
}
}
else if (speclist_enabled[client] == false)
else if (speclist_enabled[client] == false)
{
{
speclist_enabled[client] = true;
speclist_enabled[client] = true;
CreateHudHintTimer(client);
CreateHudHintTimer(client);
ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list enabled.");
ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list enabled.");
SetClientCookie(client, g_cEnabled, "1");
SetClientCookie(client, g_cEnabled, "1");
}
}
return Plugin_Handled;
return Plugin_Handled;
}
}
public Action Timer_UpdateHudHint(Handle timer, any client)
public Action Timer_UpdateHudHint(Handle timer, any client)
{
{
int iSpecModeUser = GetEntProp(client, Prop_Send, "m_iObserverMode");
int iSpecModeUser = GetEntProp(client, Prop_Send, "m_iObserverMode");
int iSpecMode, iTarget, iTargetUser;
int iSpecMode, iTarget, iTargetUser;
bool bDisplayHint = false;
bool bDisplayHint = false;
char szText[2048];
char szText[2048];
szText[0] = '\0';
szText[0] = '\0';
if (IsPlayerAlive(client))
if (IsPlayerAlive(client))
{
{
for (int i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
{
if (!IsClientInGame(i) || !IsClientObserver(i))
if (!IsClientInGame(i) || !IsClientObserver(i))
continue;
continue;
iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON)
if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON)
continue;
continue;
iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
if (speclist_stealth[i] == true)
if (speclist_stealth[i] == true)
continue;
continue;
if (iTarget == client)
if (iTarget == client)
{
{
if (IsPlayerVip(i) == true && speclist_stealth[i] == false)
if (IsPlayerVip(i) == true && speclist_stealth[i] == false)
{
{
if (IsPlayerAdmin(i) == true)
if (IsPlayerAdmin(i) == true)
{
{
Copia
Copiato
Copia
Copiato
Format(szText, sizeof(szText), "%s
<font color='#21618C'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
else
else
{
{
Copia
Copiato
Copia
Copiato
Format(szText, sizeof(szText), "%s
<font color='#D4AC0D'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
}
}
else
else
{
{
Copia
Copiato
Copia
Copiato
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
bDisplayHint = true;
bDisplayHint = true;
}
}
}
}
}
}
else if (iSpecModeUser == SPECMODE_FIRSTPERSON || iSpecModeUser == SPECMODE_3RDPERSON)
else if (iSpecModeUser == SPECMODE_FIRSTPERSON || iSpecModeUser == SPECMODE_3RDPERSON)
{
{
iTargetUser = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
iTargetUser = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
for (int i = 1; i <= MaxClients; i++)
for (int i = 1; i <= MaxClients; i++)
{
{
if (!IsClientInGame(i) || !IsClientObserver(i))
if (!IsClientInGame(i) || !IsClientObserver(i))
continue;
continue;
iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode");
if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON)
if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON)
continue;
continue;
iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget");
if (speclist_stealth[i] == true)
if (speclist_stealth[i] == true)
continue;
continue;
if (iTarget == iTargetUser)
if (iTarget == iTargetUser)
{
{
if (IsPlayerVip(i) == true)
if (IsPlayerVip(i) == true)
{
{
if (IsPlayerAdmin(i) == true)
if (IsPlayerAdmin(i) == true)
{
{
Copia
Copiato
Copia
Copiato
Format(szText, sizeof(szText), "%s
<font color='#21618C'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
else
else
{
{
Copia
Copiato
Copia
Copiato
Format(szText, sizeof(szText), "%s
<font color='#D4AC0D'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
}
}
else
else
{
{
Copia
Copiato
Copia
Copiato
Format(szText, sizeof(szText), "%s
%N. ", szText, i);
Format(szText, sizeof(szText), "%s
%N. ", szText, i);
}
}
bDisplayHint = true;
bDisplayHint = true;
}
}
}
}
}
}
if (bDisplayHint)
if (bDisplayHint)
{
{
if (speclist_enabled[client] == true)
if (speclist_enabled[client] == true)
{
{
Copia
Copiato
Copia
Copiato
PrintHintText(client, "
<font size='12'><u>Spectators:\n</u></font><font size='15'>%s</font>
", szText);
PrintHintText(client, "
%s
", szText);
bDisplayHint = false;
bDisplayHint = false;
}
}
}
}
return Plugin_Continue;
return Plugin_Continue;
}
}
void CreateHudHintTimer(int client)
void CreateHudHintTimer(int client)
{
{
HudHintTimers[client] = CreateTimer(UPDATE_INTERVAL, Timer_UpdateHudHint, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
HudHintTimers[client] = CreateTimer(UPDATE_INTERVAL, Timer_UpdateHudHint, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
}
}
void KillHudHintTimer(int client)
void KillHudHintTimer(int client)
{
{
if (HudHintTimers[client] != INVALID_HANDLE)
if (HudHintTimers[client] != INVALID_HANDLE)
{
{
KillTimer(HudHintTimers[client]);
KillTimer(HudHintTimers[client]);
HudHintTimers[client] = INVALID_HANDLE;
HudHintTimers[client] = INVALID_HANDLE;
}
}
}
}
bool IsPlayerAdmin(int client)
bool IsPlayerAdmin(int client)
{
{
if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_UNBAN))
if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_UNBAN))
return true;
return true;
return false;
return false;
}
}
bool IsPlayerVip(int client)
bool IsPlayerVip(int client)
{
{
if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_CUSTOM1))
if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_CUSTOM1))
return true;
return true;
return false;
return false;
}
}
stock bool IsValidClient(int client, bool bAllowBots = false, bool bAllowDead = true)
stock bool IsValidClient(int client, bool bAllowBots = false, bool bAllowDead = true)
{
{
if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client)))
if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client)))
{
{
return false;
return false;
}
}
return true;
return true;
}
}
Diff salvati
Testo originale
Apri file
#pragma semicolon 1 #pragma newdecls required #include <sourcemod> #include <clientprefs> #include <sdktools> #include <sdkhooks> #include <cstrike> #define SPECMODE_NONE 0 #define SPECMODE_FIRSTPERSON 4 #define SPECMODE_3RDPERSON 5 #define SPECMODE_FREELOOK 6 #define UPDATE_INTERVAL 2.5 Handle HudHintTimers[MAXPLAYERS + 1]; bool speclist_stealth[MAXPLAYERS + 1]; bool speclist_enabled[MAXPLAYERS + 1]; Handle g_cEnabled = null; public Plugin myinfo = { name = "SpecList", author = "cra88y", version = "6.9", }; public void OnPluginStart() { RegConsoleCmd("sm_speclist", Command_SpecList); RegAdminCmd("sm_stealth", Command_Stealth, ADMFLAG_ROOT); g_cEnabled = RegClientCookie("Speclist_Enabled", "Speclist on or off", CookieAccess_Protected); HookEvent("player_spawn", Event_Player_Spawn); for (int i = 1; i <= MaxClients; i++) { if (IsClientConnected(i) && IsValidClient(i) && AreClientCookiesCached(i)) { OnClientCookiesCached(i); } } } public void OnClientPostAdminCheck(int client) { CreateHudHintTimer(client); speclist_enabled[client] = true; speclist_stealth[client] = false; } public void OnClientDisconnect(int client) { if (IsClientInGame(client)) KillHudHintTimer(client); } public void OnClientCookiesCached(int client) { char CookieEnabled[16]; GetClientCookie(client, g_cEnabled, CookieEnabled, sizeof(CookieEnabled)); speclist_enabled[client] = CookieEnabled[0] == '\0' ? true : view_as<bool>(StringToInt(CookieEnabled)); if (!speclist_enabled[client]) { KillHudHintTimer(client); } /*if (g_iSpecEnabled[client] == 1) { speclist_enabled[client] = true; } else { speclist_enabled[client] = false; KillHudHintTimer(client); }*/ } public Action Event_Player_Spawn(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(GetEventInt(event, "userid")); if (IsClientConnected(client) && IsValidClient(client) && !AreClientCookiesCached(client)) { OnClientCookiesCached(client); } } public Action Command_Stealth(int client, int args) { speclist_stealth[client] = !speclist_stealth[client]; if (speclist_stealth[client] == true) ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be hidden from speclist."); if (speclist_stealth[client] == false) ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be shown on speclist."); } public Action Command_SpecList(int client, int args) { if (speclist_enabled[client] == true) { speclist_enabled[client] = false; KillHudHintTimer(client); ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list disabled."); SetClientCookie(client, g_cEnabled, "0"); } else if (speclist_enabled[client] == false) { speclist_enabled[client] = true; CreateHudHintTimer(client); ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list enabled."); SetClientCookie(client, g_cEnabled, "1"); } return Plugin_Handled; } public Action Timer_UpdateHudHint(Handle timer, any client) { int iSpecModeUser = GetEntProp(client, Prop_Send, "m_iObserverMode"); int iSpecMode, iTarget, iTargetUser; bool bDisplayHint = false; char szText[2048]; szText[0] = '\0'; if (IsPlayerAlive(client)) { for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || !IsClientObserver(i)) continue; iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode"); if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON) continue; iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); if (speclist_stealth[i] == true) continue; if (iTarget == client) { if (IsPlayerVip(i) == true && speclist_stealth[i] == false) { if (IsPlayerAdmin(i) == true) { Format(szText, sizeof(szText), "%s<font color='#21618C'>%N.</font> ", szText, i); } else { Format(szText, sizeof(szText), "%s<font color='#D4AC0D'>%N.</font> ", szText, i); } } else { Format(szText, sizeof(szText), "%s%N. ", szText, i); } bDisplayHint = true; } } } else if (iSpecModeUser == SPECMODE_FIRSTPERSON || iSpecModeUser == SPECMODE_3RDPERSON) { iTargetUser = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget"); for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || !IsClientObserver(i)) continue; iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode"); if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON) continue; iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); if (speclist_stealth[i] == true) continue; if (iTarget == iTargetUser) { if (IsPlayerVip(i) == true) { if (IsPlayerAdmin(i) == true) { Format(szText, sizeof(szText), "%s<font color='#21618C'>%N.</font> ", szText, i); } else { Format(szText, sizeof(szText), "%s<font color='#D4AC0D'>%N.</font> ", szText, i); } } else { Format(szText, sizeof(szText), "%s%N. ", szText, i); } bDisplayHint = true; } } } if (bDisplayHint) { if (speclist_enabled[client] == true) { PrintHintText(client, "<font size='12'><u>Spectators:\n</u></font><font size='15'>%s</font>", szText); bDisplayHint = false; } } return Plugin_Continue; } void CreateHudHintTimer(int client) { HudHintTimers[client] = CreateTimer(UPDATE_INTERVAL, Timer_UpdateHudHint, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); } void KillHudHintTimer(int client) { if (HudHintTimers[client] != INVALID_HANDLE) { KillTimer(HudHintTimers[client]); HudHintTimers[client] = INVALID_HANDLE; } } bool IsPlayerAdmin(int client) { if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_UNBAN)) return true; return false; } bool IsPlayerVip(int client) { if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_CUSTOM1)) return true; return false; } stock bool IsValidClient(int client, bool bAllowBots = false, bool bAllowDead = true) { if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client))) { return false; } return true; }
Testo modificato
Apri file
#pragma semicolon 1 #pragma newdecls required #include <sourcemod> #include <clientprefs> #include <sdktools> #include <sdkhooks> #include <cstrike> #define SPECMODE_NONE 0 #define SPECMODE_FIRSTPERSON 4 #define SPECMODE_3RDPERSON 5 #define SPECMODE_FREELOOK 6 #define UPDATE_INTERVAL 2.5 Handle HudHintTimers[MAXPLAYERS + 1]; bool speclist_stealth[MAXPLAYERS + 1]; bool speclist_enabled[MAXPLAYERS + 1]; Handle g_cEnabled = null; public Plugin myinfo = { name = "SpecList/Fix", author = "cra88y/Timid", version = "7.1", }; public void OnPluginStart() { RegConsoleCmd("sm_speclist", Command_SpecList); RegAdminCmd("sm_stealth", Command_Stealth, ADMFLAG_ROOT); g_cEnabled = RegClientCookie("Speclist_Enabled", "Speclist on or off", CookieAccess_Protected); HookEvent("player_spawn", Event_Player_Spawn); for (int i = 1; i <= MaxClients; i++) { if (IsClientConnected(i) && IsValidClient(i) && AreClientCookiesCached(i)) { OnClientCookiesCached(i); } } } public void OnClientPostAdminCheck(int client) { CreateHudHintTimer(client); speclist_enabled[client] = true; speclist_stealth[client] = false; } public void OnClientDisconnect(int client) { if (IsClientInGame(client)) KillHudHintTimer(client); } public void OnClientCookiesCached(int client) { char CookieEnabled[16]; GetClientCookie(client, g_cEnabled, CookieEnabled, sizeof(CookieEnabled)); speclist_enabled[client] = CookieEnabled[0] == '\0' ? true : view_as<bool>(StringToInt(CookieEnabled)); if (!speclist_enabled[client]) { KillHudHintTimer(client); } /*if (g_iSpecEnabled[client] == 1) { speclist_enabled[client] = true; } else { speclist_enabled[client] = false; KillHudHintTimer(client); }*/ } public Action Event_Player_Spawn(Event event, const char[] name, bool dontBroadcast) { int client = GetClientOfUserId(GetEventInt(event, "userid")); if (IsClientConnected(client) && IsValidClient(client) && !AreClientCookiesCached(client)) { OnClientCookiesCached(client); } } public Action Command_Stealth(int client, int args) { speclist_stealth[client] = !speclist_stealth[client]; if (speclist_stealth[client] == true) ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be hidden from speclist."); if (speclist_stealth[client] == false) ReplyToCommand(client, "\x01[\x02SpecList\x01] You will now be shown on speclist."); } public Action Command_SpecList(int client, int args) { if (speclist_enabled[client] == true) { speclist_enabled[client] = false; KillHudHintTimer(client); ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list disabled."); SetClientCookie(client, g_cEnabled, "0"); } else if (speclist_enabled[client] == false) { speclist_enabled[client] = true; CreateHudHintTimer(client); ReplyToCommand(client, "\x01[\x02SpecList\x01] Spectator list enabled."); SetClientCookie(client, g_cEnabled, "1"); } return Plugin_Handled; } public Action Timer_UpdateHudHint(Handle timer, any client) { int iSpecModeUser = GetEntProp(client, Prop_Send, "m_iObserverMode"); int iSpecMode, iTarget, iTargetUser; bool bDisplayHint = false; char szText[2048]; szText[0] = '\0'; if (IsPlayerAlive(client)) { for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || !IsClientObserver(i)) continue; iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode"); if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON) continue; iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); if (speclist_stealth[i] == true) continue; if (iTarget == client) { if (IsPlayerVip(i) == true && speclist_stealth[i] == false) { if (IsPlayerAdmin(i) == true) { Format(szText, sizeof(szText), "%s %N.", szText, i); } else { Format(szText, sizeof(szText), "%s %N.", szText, i); } } else { Format(szText, sizeof(szText), "%s %N.", szText, i); } bDisplayHint = true; } } } else if (iSpecModeUser == SPECMODE_FIRSTPERSON || iSpecModeUser == SPECMODE_3RDPERSON) { iTargetUser = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget"); for (int i = 1; i <= MaxClients; i++) { if (!IsClientInGame(i) || !IsClientObserver(i)) continue; iSpecMode = GetEntProp(i, Prop_Send, "m_iObserverMode"); if (iSpecMode != SPECMODE_FIRSTPERSON && iSpecMode != SPECMODE_3RDPERSON) continue; iTarget = GetEntPropEnt(i, Prop_Send, "m_hObserverTarget"); if (speclist_stealth[i] == true) continue; if (iTarget == iTargetUser) { if (IsPlayerVip(i) == true) { if (IsPlayerAdmin(i) == true) { Format(szText, sizeof(szText), "%s %N.", szText, i); } else { Format(szText, sizeof(szText), "%s %N.", szText, i); } } else { Format(szText, sizeof(szText), "%s %N. ", szText, i); } bDisplayHint = true; } } } if (bDisplayHint) { if (speclist_enabled[client] == true) { PrintHintText(client, "%s", szText); bDisplayHint = false; } } return Plugin_Continue; } void CreateHudHintTimer(int client) { HudHintTimers[client] = CreateTimer(UPDATE_INTERVAL, Timer_UpdateHudHint, client, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE); } void KillHudHintTimer(int client) { if (HudHintTimers[client] != INVALID_HANDLE) { KillTimer(HudHintTimers[client]); HudHintTimers[client] = INVALID_HANDLE; } } bool IsPlayerAdmin(int client) { if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_UNBAN)) return true; return false; } bool IsPlayerVip(int client) { if (IsClientInGame(client) && CheckCommandAccess(client, "", ADMFLAG_CUSTOM1)) return true; return false; } stock bool IsValidClient(int client, bool bAllowBots = false, bool bAllowDead = true) { if (!(1 <= client <= MaxClients) || !IsClientInGame(client) || (IsFakeClient(client) && !bAllowBots) || IsClientSourceTV(client) || IsClientReplay(client) || (!bAllowDead && !IsPlayerAlive(client))) { return false; } return true; }
Trovare la differenza