CashManager: add prints to chat

This commit is contained in:
dogan 2020-08-17 16:13:21 +02:00
parent cc1b809d93
commit 47d259d5e8

View File

@ -4,6 +4,7 @@
#include <cstrike> #include <cstrike>
#include <sdkhooks> #include <sdkhooks>
#include <sdktools> #include <sdktools>
#include <multicolors>
#undef REQUIRE_PLUGIN #undef REQUIRE_PLUGIN
#tryinclude <zombiereloaded> #tryinclude <zombiereloaded>
@ -42,7 +43,7 @@ public Plugin myinfo =
name = "Cash Manager", name = "Cash Manager",
author = "Obus + Dogan", author = "Obus + Dogan",
description = "Manage Cash with additional gains and limits", description = "Manage Cash with additional gains and limits",
version = "1.2.0", version = "2.0.0",
url = "" url = ""
}; };
@ -136,7 +137,7 @@ public Action MessageReconnect(Handle timer, int client)
if(!IsClientInGame(client)) if(!IsClientInGame(client))
return Plugin_Handled; return Plugin_Handled;
PrintToChat(client, "[SM] Restored your cash: $%d.", g_iCash[client]); CPrintToChat(client, "{cyan}[UNLOZE CashManager] {white}Restored your cash: {yellow}$%d{white}.", g_iCash[client]);
return Plugin_Handled; return Plugin_Handled;
} }
@ -176,7 +177,10 @@ public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, boo
g_bMotherZombie[client] = motherInfect; g_bMotherZombie[client] = motherInfect;
if(!motherInfect && IsValidClient(attacker) && !(GetEntProp(attacker, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) if(!motherInfect && IsValidClient(attacker) && !(GetEntProp(attacker, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
{
SetEntProp(attacker, Prop_Send, "m_iAccount", GetEntProp(attacker, Prop_Send, "m_iAccount") + g_cvarInfectionGain.IntValue); SetEntProp(attacker, Prop_Send, "m_iAccount", GetEntProp(attacker, Prop_Send, "m_iAccount") + g_cvarInfectionGain.IntValue);
CPrintToChat(attacker, "{cyan}[UNLOZE CashManager] {white}Gained {yellow}$%d{white} for infecting an Human.", g_cvarInfectionGain.IntValue);
}
} }
public void OnStartTouch(const char[] sOutput, int iCaller, int iActivator, float fDelay) public void OnStartTouch(const char[] sOutput, int iCaller, int iActivator, float fDelay)
@ -198,7 +202,10 @@ public void OnStartTouch(const char[] sOutput, int iCaller, int iActivator, floa
CreateTimer(fTriggerCD, ResetTriggerCD); CreateTimer(fTriggerCD, ResetTriggerCD);
if(!(GetEntProp(iActivator, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) if(!(GetEntProp(iActivator, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
{
SetEntProp(iActivator, Prop_Send, "m_iAccount", GetEntProp(iActivator, Prop_Send, "m_iAccount") + g_cvarHumanTriggerGain.IntValue); SetEntProp(iActivator, Prop_Send, "m_iAccount", GetEntProp(iActivator, Prop_Send, "m_iAccount") + g_cvarHumanTriggerGain.IntValue);
CPrintToChat(iActivator, "{cyan}[UNLOZE CashManager] {white}Gained {yellow}$%d{white} for getting a Trigger.", g_cvarHumanTriggerGain.IntValue);
}
} }
public void OnPressed(const char[] sOutput, int iCaller, int iActivator, float fDelay) public void OnPressed(const char[] sOutput, int iCaller, int iActivator, float fDelay)
@ -230,7 +237,10 @@ public void OnPressed(const char[] sOutput, int iCaller, int iActivator, float f
CreateTimer(fTriggerCD, ResetTriggerCD); CreateTimer(fTriggerCD, ResetTriggerCD);
if(!(GetEntProp(iActivator, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) if(!(GetEntProp(iActivator, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
{
SetEntProp(iActivator, Prop_Send, "m_iAccount", GetEntProp(iActivator, Prop_Send, "m_iAccount") + g_cvarHumanTriggerGain.IntValue); SetEntProp(iActivator, Prop_Send, "m_iAccount", GetEntProp(iActivator, Prop_Send, "m_iAccount") + g_cvarHumanTriggerGain.IntValue);
CPrintToChat(iActivator, "{cyan}[UNLOZE CashManager] {white}Gained {yellow}$%d{white} for getting a Trigger.", g_cvarHumanTriggerGain.IntValue);
}
} }
public Action ResetTriggerCD(Handle timer) public Action ResetTriggerCD(Handle timer)
@ -251,11 +261,13 @@ public Action EventHook_RoundEnd(Event hEvent, const char[] sEventName, bool bDo
if(GetClientTeam(i) == CS_TEAM_CT && bAwardHumans && !(GetEntProp(i, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) if(GetClientTeam(i) == CS_TEAM_CT && bAwardHumans && !(GetEntProp(i, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
{ {
SetEntProp(i, Prop_Send, "m_iAccount", GetEntProp(i, Prop_Send, "m_iAccount") + g_cvarHumanWinGain.IntValue); SetEntProp(i, Prop_Send, "m_iAccount", GetEntProp(i, Prop_Send, "m_iAccount") + g_cvarHumanWinGain.IntValue);
CPrintToChat(i, "{cyan}[UNLOZE CashManager] {white}Gained {yellow}$%d{white} for winning as Human.", g_cvarHumanWinGain.IntValue);
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount"); g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
} }
else if(GetClientTeam(i) == CS_TEAM_T && bAwardZombies && g_bMotherZombie[i] && !(GetEntProp(i, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) else if(GetClientTeam(i) == CS_TEAM_T && bAwardZombies && g_bMotherZombie[i] && !(GetEntProp(i, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
{ {
SetEntProp(i, Prop_Send, "m_iAccount", GetEntProp(i, Prop_Send, "m_iAccount") + g_cvarMotherZombieWinGain.IntValue); SetEntProp(i, Prop_Send, "m_iAccount", GetEntProp(i, Prop_Send, "m_iAccount") + g_cvarMotherZombieWinGain.IntValue);
CPrintToChat(i, "{cyan}[UNLOZE CashManager] {white}Gained {yellow}$%d{white} for winning as MotherZombie.", g_cvarMotherZombieWinGain.IntValue);
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount"); g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
} }
else else
@ -324,9 +336,14 @@ public Action EventHook_PlayerDeath(Event hEvent, const char[] sEventName, bool
return Plugin_Continue; return Plugin_Continue;
if(ZR_IsClientZombie(attacker) && StrEqual(sWeapon, "knife", true) && !(GetEntProp(attacker, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) //nemesis kill if(ZR_IsClientZombie(attacker) && StrEqual(sWeapon, "knife", true) && !(GetEntProp(attacker, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue)) //nemesis kill
{
SetEntProp(attacker, Prop_Send, "m_iAccount", GetEntProp(attacker, Prop_Send, "m_iAccount") + g_cvarInfectionGain.IntValue); SetEntProp(attacker, Prop_Send, "m_iAccount", GetEntProp(attacker, Prop_Send, "m_iAccount") + g_cvarInfectionGain.IntValue);
CPrintToChat(attacker, "{cyan}[UNLOZE CashManager] {white}Gained {yellow}$%d{white} for killing an Human.", g_cvarInfectionGain.IntValue);
}
else if(ZR_IsClientZombie(attacker)) // regular infection else if(ZR_IsClientZombie(attacker)) // regular infection
{
return Plugin_Continue; return Plugin_Continue;
}
int iPacked = (attacker<<16) | (GetEntProp(attacker, Prop_Send, "m_iAccount")&0xFFFF); int iPacked = (attacker<<16) | (GetEntProp(attacker, Prop_Send, "m_iAccount")&0xFFFF);