made message less spammy, added round start prevention so it first checks zones after a minute and added low grav for zm
This commit is contained in:
parent
9a44ce1f17
commit
c096d716da
@ -16,6 +16,8 @@ int g_iCT_Damage_in_zone[MAXPLAYERS + 1];
|
|||||||
int g_iZone_fought_or_ct_controlled[MAXZONES];
|
int g_iZone_fought_or_ct_controlled[MAXZONES];
|
||||||
int g_iLast_Client_In_Zone[MAXPLAYERS + 1];
|
int g_iLast_Client_In_Zone[MAXPLAYERS + 1];
|
||||||
int ping_ents[MAXPLAYERS + 1];
|
int ping_ents[MAXPLAYERS + 1];
|
||||||
|
int g_iAnnounce_zone_controll = 0;
|
||||||
|
bool g_permit_zone_benefits = false;
|
||||||
|
|
||||||
bool round_start_delay;
|
bool round_start_delay;
|
||||||
|
|
||||||
@ -35,6 +37,7 @@ ConVar g_hHealthRegenAmount;
|
|||||||
Handle hText;
|
Handle hText;
|
||||||
Handle g_hZMZoneTimer = null;
|
Handle g_hZMZoneTimer = null;
|
||||||
Handle g_hZoneCounter = null;
|
Handle g_hZoneCounter = null;
|
||||||
|
Handle g_hZoneBenefits = null;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -70,7 +73,7 @@ public void OnPluginStart()
|
|||||||
round_start_delay = true;
|
round_start_delay = true;
|
||||||
//timer for ZM zone benefits
|
//timer for ZM zone benefits
|
||||||
g_hZMZoneTimer = CreateTimer(5.0, give_zm_zone_boosts, _, TIMER_REPEAT);
|
g_hZMZoneTimer = CreateTimer(5.0, give_zm_zone_boosts, _, TIMER_REPEAT);
|
||||||
g_hZoneCounter = CreateTimer(30.0, announce_zone_controlls, _, TIMER_REPEAT);
|
g_hZoneCounter = CreateTimer(10.0, announce_zone_controlls, _, TIMER_REPEAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action announce_zone_controlls(Handle hTimer)
|
public Action announce_zone_controlls(Handle hTimer)
|
||||||
@ -78,7 +81,7 @@ public Action announce_zone_controlls(Handle hTimer)
|
|||||||
float fought_zone = 0.0;
|
float fought_zone = 0.0;
|
||||||
float ct_controlled_zone = 0.0;
|
float ct_controlled_zone = 0.0;
|
||||||
float zm_controlled_zone = 0.0;
|
float zm_controlled_zone = 0.0;
|
||||||
if (g_zoneCount == 0)
|
if (g_zoneCount == 0 || !g_permit_zone_benefits)
|
||||||
{
|
{
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
@ -97,30 +100,80 @@ public Action announce_zone_controlls(Handle hTimer)
|
|||||||
zm_controlled_zone++;
|
zm_controlled_zone++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
g_iAnnounce_zone_controll++;
|
||||||
int ct_control_percentage = RoundToFloor((ct_controlled_zone/ g_zoneCount) * 100);
|
int ct_control_percentage = RoundToFloor((ct_controlled_zone/ g_zoneCount) * 100);
|
||||||
int zm_control_percentage = RoundToFloor((zm_controlled_zone/ g_zoneCount) * 100);
|
int zm_control_percentage = RoundToFloor((zm_controlled_zone/ g_zoneCount) * 100);
|
||||||
int fought_percentage = RoundToFloor((fought_zone/ g_zoneCount) * 100);
|
int fought_percentage = RoundToFloor((fought_zone/ g_zoneCount) * 100);
|
||||||
PrintToChatAll("CT controll %i%s of zones. ZM controll %i%s of zones. %i%s of zones are fought over",
|
if (g_iAnnounce_zone_controll >= 3)
|
||||||
|
{
|
||||||
|
PrintToChatAll("CT controll %i%s of zones. ZM controll %i%s of zones. %i%s of zones are fought over",
|
||||||
ct_control_percentage, "%", zm_control_percentage, "%", fought_percentage, "%");
|
ct_control_percentage, "%", zm_control_percentage, "%", fought_percentage, "%");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zm_control_percentage > 70)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i) && IsPlayerAlive(i))
|
||||||
|
{
|
||||||
|
if (GetClientTeam(i) == CS_TEAM_T)
|
||||||
|
{
|
||||||
|
SetEntityGravity(i, 0.7);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetEntityGravity(i, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (g_iAnnounce_zone_controll >= 3)
|
||||||
|
{
|
||||||
|
PrintToChatAll("ZM controll over 70%s of zones. Applying 30%s low grav", "%", "%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i) && IsPlayerAlive(i))
|
||||||
|
{
|
||||||
|
SetEntityGravity(i, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ct_control_percentage > 90)
|
if (ct_control_percentage > 90)
|
||||||
{
|
{
|
||||||
g_human_damage_addition = 0.6;
|
g_human_damage_addition = 0.6;
|
||||||
PrintToChatAll("CT controll over 90%s of zones. Applying 60%s extra damage", "%", "%");
|
if (g_iAnnounce_zone_controll >= 3)
|
||||||
|
{
|
||||||
|
PrintToChatAll("CT controll over 90%s of zones. Applying 60%s extra damage", "%", "%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ct_control_percentage > 70)
|
else if (ct_control_percentage > 70)
|
||||||
{
|
{
|
||||||
g_human_damage_addition = 0.40;
|
g_human_damage_addition = 0.40;
|
||||||
PrintToChatAll("CT controll over 70%s of zones. Applying 40%s extra damage", "%", "%");
|
if (g_iAnnounce_zone_controll >= 3)
|
||||||
|
{
|
||||||
|
PrintToChatAll("CT controll over 70%s of zones. Applying 40%s extra damage", "%", "%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (ct_control_percentage > 50)
|
else if (ct_control_percentage > 50)
|
||||||
{
|
{
|
||||||
g_human_damage_addition = 0.2;
|
g_human_damage_addition = 0.2;
|
||||||
PrintToChatAll("CT controll over 50%s of zones. Applying 20%s extra damage", "%", "%");
|
if (g_iAnnounce_zone_controll >= 3)
|
||||||
|
{
|
||||||
|
PrintToChatAll("CT controll over 50%s of zones. Applying 20%s extra damage", "%", "%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_human_damage_addition = 1.0; //indicating no damage buffs
|
g_human_damage_addition = 1.0; //indicating no damage buffs
|
||||||
}
|
}
|
||||||
|
if (g_iAnnounce_zone_controll >= 3)
|
||||||
|
{
|
||||||
|
g_iAnnounce_zone_controll = 0;
|
||||||
|
}
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,6 +221,8 @@ public void OnPluginEnd()
|
|||||||
delete g_hZMZoneTimer;
|
delete g_hZMZoneTimer;
|
||||||
if (g_hZoneCounter != null)
|
if (g_hZoneCounter != null)
|
||||||
delete g_hZoneCounter;
|
delete g_hZoneCounter;
|
||||||
|
if (g_hZoneBenefits != null)
|
||||||
|
delete g_hZoneBenefits;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
@ -213,6 +268,11 @@ public void adjust_clients()
|
|||||||
|
|
||||||
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
|
if(g_hZoneBenefits != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
KillTimer(g_hZoneBenefits);
|
||||||
|
g_hZoneBenefits = INVALID_HANDLE;
|
||||||
|
}
|
||||||
round_start_delay = true;
|
round_start_delay = true;
|
||||||
bool found_alive_zm = false;
|
bool found_alive_zm = false;
|
||||||
for (int client = 0; client < MaxClients; client++)
|
for (int client = 0; client < MaxClients; client++)
|
||||||
@ -238,11 +298,19 @@ public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action permit_zone_benefits(Handle hTimer)
|
||||||
|
{
|
||||||
|
g_permit_zone_benefits = true;
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||||
{
|
{
|
||||||
|
g_permit_zone_benefits = false;
|
||||||
|
g_hZoneBenefits = CreateTimer(60.0, permit_zone_benefits);
|
||||||
g_human_damage_addition = 1.0;
|
g_human_damage_addition = 1.0;
|
||||||
for (int client = 0; client < MaxClients; client++)
|
for (int client = 0; client < MaxClients; client++)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user