CashManager: more stuff
This commit is contained in:
parent
168235ae03
commit
1a0a2dd75d
@ -17,6 +17,7 @@ ConVar g_cvarDamageMultiplier = null;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ConVar g_cvarInfectionGain;
|
ConVar g_cvarInfectionGain;
|
||||||
|
ConVar g_cvarMotherZombieWinGain;
|
||||||
ConVar g_cvarHumanWinGain;
|
ConVar g_cvarHumanWinGain;
|
||||||
ConVar g_cvarRoundStartGain;
|
ConVar g_cvarRoundStartGain;
|
||||||
ConVar g_cvarMaxCash;
|
ConVar g_cvarMaxCash;
|
||||||
@ -24,6 +25,8 @@ ConVar g_cvarMaxCash;
|
|||||||
bool g_bZRLoaded;
|
bool g_bZRLoaded;
|
||||||
bool g_bMapEnd;
|
bool g_bMapEnd;
|
||||||
|
|
||||||
|
bool g_bMotherZombie[MAXPLAYERS + 1];
|
||||||
|
|
||||||
int g_iCash[MAXPLAYERS + 1];
|
int g_iCash[MAXPLAYERS + 1];
|
||||||
int g_iCashReconnect[256];
|
int g_iCashReconnect[256];
|
||||||
int g_iSteamID[256];
|
int g_iSteamID[256];
|
||||||
@ -33,7 +36,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.1.0",
|
version = "1.2.0",
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,6 +45,7 @@ public void OnPluginStart()
|
|||||||
#if defined DMGINSTEADOFHITS
|
#if defined DMGINSTEADOFHITS
|
||||||
g_cvarDamageMultiplier = CreateConVar("sm_damagecashmultiplier", "1.0", "Multiplier that decides how much cash a client shall receive upon dealing damage");
|
g_cvarDamageMultiplier = CreateConVar("sm_damagecashmultiplier", "1.0", "Multiplier that decides how much cash a client shall receive upon dealing damage");
|
||||||
g_cvarInfectionGain = CreateConVar("sm_infectioncashgain", "500", "Cash a client shall receive upon infection");
|
g_cvarInfectionGain = CreateConVar("sm_infectioncashgain", "500", "Cash a client shall receive upon infection");
|
||||||
|
g_cvarMotherZombieWinGain = CreateConVar("sm_motherzombiecashgain", "2500", "Cash a client shall receive upon zombie win while being motherzombie");
|
||||||
g_cvarHumanWinGain = CreateConVar("sm_humanwincashgain", "2500", "Cash a human shall receive upon human win");
|
g_cvarHumanWinGain = CreateConVar("sm_humanwincashgain", "2500", "Cash a human shall receive upon human win");
|
||||||
g_cvarRoundStartGain = CreateConVar("sm_roundstartcashgain", "2500", "Cash everyone shall receive upon round start");
|
g_cvarRoundStartGain = CreateConVar("sm_roundstartcashgain", "2500", "Cash everyone shall receive upon round start");
|
||||||
g_cvarMaxCash = CreateConVar("sm_maxcash", "45000", "Max cash you can store");
|
g_cvarMaxCash = CreateConVar("sm_maxcash", "45000", "Max cash you can store");
|
||||||
@ -101,6 +105,8 @@ public void OnClientPutInServer(int client)
|
|||||||
if(IsFakeClient(client) || g_bMapEnd)
|
if(IsFakeClient(client) || g_bMapEnd)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_iCash[client] = 16000 - g_cvarRoundStartGain.IntValue;
|
||||||
|
|
||||||
int iSteamID = GetSteamAccountID(client);
|
int iSteamID = GetSteamAccountID(client);
|
||||||
|
|
||||||
for(int i = 0; i < 256; i++)
|
for(int i = 0; i < 256; i++)
|
||||||
@ -151,28 +157,37 @@ public void OnClientDisconnect(int client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_iCash[client] = 0;
|
g_iCash[client] = 0;
|
||||||
|
g_bMotherZombie[client] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
|
public void ZR_OnClientInfected(int client, int attacker, bool motherInfect, bool respawnOverride, bool respawn)
|
||||||
{
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action EventHook_RoundEnd(Event hEvent, const char[] sEventName, bool bDontBroadcast)
|
public Action EventHook_RoundEnd(Event hEvent, const char[] sEventName, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
bool bAwardHumans = hEvent.GetInt("winner") == CS_TEAM_CT;
|
bool bAwardHumans = (hEvent.GetInt("winner") == CS_TEAM_CT);
|
||||||
|
bool bAwardZombies = (hEvent.GetInt("winner") == CS_TEAM_T);
|
||||||
|
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
if(!IsValidClient(i))
|
if(!IsValidClient(i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(ZR_IsClientHuman(i) && 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);
|
||||||
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
|
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
|
||||||
}
|
}
|
||||||
|
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);
|
||||||
|
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
|
g_iCash[i] = GetEntProp(i, Prop_Send, "m_iAccount");
|
||||||
@ -184,6 +199,8 @@ public Action EventHook_RoundStart(Event hEvent, const char[] sEventName, bool b
|
|||||||
{
|
{
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
|
g_bMotherZombie[i] = false;
|
||||||
|
|
||||||
if(IsValidClient(i) && !(GetEntProp(i, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
|
if(IsValidClient(i) && !(GetEntProp(i, Prop_Send, "m_iAccount") >= g_cvarMaxCash.IntValue))
|
||||||
g_iCash[i] = g_iCash[i] + g_cvarRoundStartGain.IntValue;
|
g_iCash[i] = g_iCash[i] + g_cvarRoundStartGain.IntValue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user