Diff
checker
テキスト
テキスト
画像
ドキュメント
Excel
フォルダ
Legal
Enterprise
デスクトップ
料金
ログイン
Diffchecker デスクトップのダウンロード
テキスト比較
2 つのテキスト ファイルの違いを見つける
ツール
履歴
ライブエディター
未変更行を折りたたむ
折り返しなし
レイアウト
分割
統合
比較精度
スマート
単語
文字
シンタックスハイライト
構文を選択
無視
テキスト変換
最初の差分へ移動
入力を編集
Diffchecker Desktop
Diffcheckerを実行する最も安全な方法。Diffchecker Desktopアプリを入手:あなたの差分はコンピューターから出ることはありません!
Desktopを入手
Untitled Diff
作成日
6 年前
差分は期限切れになりません
クリア
エクスポート
共有
説明
11 削除
行
合計
削除
文字
合計
削除
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
248 行
すべてコピー
10 追加
行
合計
追加
文字
合計
追加
この機能を引き続き使用するには、アップグレードしてください
Diff
checker
Pro
価格を見る
248 行
すべてコピー
#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 =
{
{
コピー
コピー済み
コピー
コピー済み
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)
{
{
コピー
コピー済み
コピー
コピー済み
Format(szText, sizeof(szText), "%s
<font color='#21618C'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
else
else
{
{
コピー
コピー済み
コピー
コピー済み
Format(szText, sizeof(szText), "%s
<font color='#D4AC0D'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
}
}
else
else
{
{
コピー
コピー済み
コピー
コピー済み
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)
{
{
コピー
コピー済み
コピー
コピー済み
Format(szText, sizeof(szText), "%s
<font color='#21618C'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
else
else
{
{
コピー
コピー済み
コピー
コピー済み
Format(szText, sizeof(szText), "%s
<font color='#D4AC0D'>
%N.
</font>
", szText, i);
Format(szText, sizeof(szText), "%s
%N.
", szText, i);
}
}
}
}
else
else
{
{
コピー
コピー済み
コピー
コピー済み
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)
{
{
コピー
コピー済み
コピー
コピー済み
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;
}
}
保存された差分
原文
ファイルを開く
#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; }
変更されたテキスト
ファイルを開く
#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; }
違いを見つける