PlayerRankings: lazy zuff

This commit is contained in:
Dogan 2019-07-16 20:39:13 +02:00
parent f370e88b55
commit d1a862fcfe
2 changed files with 29 additions and 27 deletions

View File

@ -12,12 +12,12 @@
/* BOOLS */
bool g_bEngineCSGO;
bool g_bHideCrown[MAXPLAYERS+1];
bool g_bHideHeadModels[MAXPLAYERS+1];
bool g_bHideDialog[MAXPLAYERS+1];
bool g_bProtection[MAXPLAYERS+1];
/* COOKIES */
Handle g_hCookie_HideCrown;
Handle g_hCookie_HideHeadModels;
Handle g_hCookie_HideDialog;
Handle g_hCookie_Protection;
@ -65,7 +65,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
LoadTranslations("plugin.topdefenders.phrases");
LoadTranslations("plugin.playerrankings.phrases");
g_bEngineCSGO = view_as<bool>(GetEngineVersion() == Engine_CSGO);
@ -74,14 +74,16 @@ public void OnPluginStart()
g_hCVar_ProtectionMinimal2 = CreateConVar("sm_topdefenders_minimal_2", "30", "", FCVAR_NONE, true, 1.0, true, 64.0);
g_hCVar_ProtectionMinimal3 = CreateConVar("sm_topdefenders_minimal_3", "45", "", FCVAR_NONE, true, 1.0, true, 64.0);
g_hCookie_HideCrown = RegClientCookie("topdefenders_hidecrown", "", CookieAccess_Private);
g_hCookie_HideHeadModels = RegClientCookie("topdefenders_hideheadmodels", "", CookieAccess_Private);
g_hCookie_HideDialog = RegClientCookie("topdefenders_hidedialog", "", CookieAccess_Private);
g_hCookie_Protection = RegClientCookie("topdefenders_protection", "", CookieAccess_Private);
CreateTimer(0.1, UpdateScoreboard, INVALID_HANDLE, TIMER_REPEAT);
CreateTimer(0.1, UpdateDialog, INVALID_HANDLE, TIMER_REPEAT);
RegConsoleCmd("sm_togglecrown", OnToggleCrown);
RegConsoleCmd("sm_togglecrown", OnToggleHeadModels);
RegConsoleCmd("sm_toggleskull", OnToggleHeadModels);
RegConsoleCmd("sm_toggleheadmodels", OnToggleHeadModels);
RegConsoleCmd("sm_toggledialog", OnToggleDialog);
RegConsoleCmd("sm_toggleimmunity", OnToggleImmunity);
@ -91,15 +93,15 @@ public void OnPluginStart()
HookEvent("player_spawn", OnClientSpawn);
HookEvent("player_death", OnClientDeath);
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Player Rankings");
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "PlayerRankings");
}
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public Action OnToggleCrown(int client, int args)
public Action OnToggleHeadModels(int client, int args)
{
ToggleCrown(client);
ToggleHeadModels(client);
return Plugin_Handled;
}
@ -124,13 +126,13 @@ public Action OnToggleImmunity(int client, int args)
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void ToggleCrown(int client)
public void ToggleHeadModels(int client)
{
g_bHideCrown[client] = !g_bHideCrown[client];
g_bHideHeadModels[client] = !g_bHideHeadModels[client];
SetClientCookie(client, g_hCookie_HideCrown, g_bHideCrown[client] ? "1" : "");
SetClientCookie(client, g_hCookie_HideHeadModels, g_bHideHeadModels[client] ? "1" : "");
CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", g_bHideCrown[client] ? "Crown Disabled" : "Crown Enabled");
CPrintToChat(client, "{cyan}%t {white}%t", "Chat Prefix", g_bHideHeadModels[client] ? "Head Models Disabled" : "Head Models Enabled");
}
//----------------------------------------------------------------------------------------------------
@ -166,7 +168,7 @@ public void ShowSettingsMenu(int client)
menu.SetTitle("%T", "Cookie Menu Title", client);
AddMenuItemTranslated(menu, "0", "%t: %t", "Crown", g_bHideCrown[client] ? "Disabled" : "Enabled");
AddMenuItemTranslated(menu, "0", "%t: %t", "Head Model", g_bHideHeadModels[client] ? "Disabled" : "Enabled");
AddMenuItemTranslated(menu, "1", "%t: %t", "Dialog", g_bHideDialog[client] ? "Disabled" : "Enabled");
AddMenuItemTranslated(menu, "2", "%t: %t", "Immunity", g_bProtection[client] ? "Disabled" : "Enabled");
@ -204,7 +206,7 @@ public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int se
{
switch(selection)
{
case(0): ToggleCrown(client);
case(0): ToggleHeadModels(client);
case(1): ToggleDialog(client);
case(2): ToggleImmunity(client);
}
@ -264,12 +266,12 @@ public void OnMapStart()
public void OnClientCookiesCached(int client)
{
char sBuffer[4];
GetClientCookie(client, g_hCookie_HideCrown, sBuffer, sizeof(sBuffer));
GetClientCookie(client, g_hCookie_HideHeadModels, sBuffer, sizeof(sBuffer));
if (sBuffer[0])
g_bHideCrown[client] = true;
g_bHideHeadModels[client] = true;
else
g_bHideCrown[client] = false;
g_bHideHeadModels[client] = false;
GetClientCookie(client, g_hCookie_HideDialog, sBuffer, sizeof(sBuffer));
@ -296,7 +298,7 @@ public void OnClientDisconnect(int client)
g_iPlayerDamageFrom1K[client] = 0;
g_iPlayerInfections[client] = 0;
g_bHideCrown[client] = false;
g_bHideHeadModels[client] = false;
g_bHideDialog[client] = false;
g_bProtection[client] = false;
}
@ -586,7 +588,7 @@ public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (!g_bHideCrown[client])
if (!g_bHideHeadModels[client])
{
if (g_iPlayerWinner[0] == GetSteamAccountID(client))
{

View File

@ -6,11 +6,11 @@
}
"Cookie Menu"
{
"en" "Player Rankings"
"en" "PlayerRankings"
}
"Cookie Menu Title"
{
"en" "Player Rankings Settings"
"en" "PlayerRankings Settings"
}
"Enabled"
{
@ -20,17 +20,17 @@
{
"en" "Disabled"
}
"Crown"
"Head Model"
{
"en" "Crowns"
"en" "Head Models"
}
"Crown Enabled"
"Head Models Enabled"
{
"en" "You will now spawn with a crown again."
"en" "You will now spawn with a head model again."
}
"Crown Disabled"
"Head Models Disabled"
{
"en" "You will no longer spawn with a crown."
"en" "You will no longer spawn with a head model."
}
"Dialog"
{