updating zh stuff
This commit is contained in:
parent
1f2f558aa1
commit
6ab0461bf8
@ -1,6 +1,7 @@
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
#include <unloze_zones>
|
||||
#include <sdkhooks>
|
||||
#include <cstrike>
|
||||
#include <PlayerRankings>
|
||||
#include <hlstatsx_loghelper>
|
||||
@ -27,11 +28,13 @@ int g_zoneCount = 0;
|
||||
int client_target[MAXPLAYERS + 1];
|
||||
float g_fStartPos[MAXZONES][3];
|
||||
float g_fEndPos[MAXZONES][3];
|
||||
float g_human_damage_addition;
|
||||
ConVar g_hRespawnTreshold;
|
||||
ConVar g_hHealthRegenZM;
|
||||
ConVar g_hHealthRegenAmount;
|
||||
Handle hText;
|
||||
Handle g_hZMZoneTimer = null;
|
||||
Handle g_hZoneCounter = null;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -67,6 +70,74 @@ public void OnPluginStart()
|
||||
round_start_delay = true;
|
||||
//timer for ZM zone benefits
|
||||
g_hZMZoneTimer = CreateTimer(5.0, give_zm_zone_boosts, _, TIMER_REPEAT);
|
||||
g_hZoneCounter = CreateTimer(30.0, announce_zone_controlls, _, TIMER_REPEAT);
|
||||
}
|
||||
|
||||
public Action announce_zone_controlls(Handle hTimer)
|
||||
{
|
||||
float fought_zone = 0.0;
|
||||
float ct_controlled_zone = 0.0;
|
||||
float zm_controlled_zone = 0.0;
|
||||
if (g_zoneCount == 0)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
}
|
||||
for (int i = 0; i < g_zoneCount; i++)
|
||||
{
|
||||
if (g_iZone_fought_or_ct_controlled[i] == 1) //fought over zone
|
||||
{
|
||||
fought_zone++;
|
||||
}
|
||||
if (g_iZone_fought_or_ct_controlled[i] == 2) //CT zone
|
||||
{
|
||||
ct_controlled_zone++;
|
||||
}
|
||||
if (g_iZone_fought_or_ct_controlled[i] == 3) //ZM zone
|
||||
{
|
||||
zm_controlled_zone++;
|
||||
}
|
||||
}
|
||||
int ct_control_percentage = RoundToFloor((ct_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);
|
||||
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, "%");
|
||||
if (ct_control_percentage > 90)
|
||||
{
|
||||
g_human_damage_addition = 50.0;
|
||||
PrintToChatAll("CT controll over 90%s of zones. Applying 50%s extra damage", "%", "%");
|
||||
}
|
||||
else if (ct_control_percentage > 70)
|
||||
{
|
||||
g_human_damage_addition = 30.0;
|
||||
PrintToChatAll("CT controll over 70%s of zones. Applying 30%s extra damage", "%", "%");
|
||||
}
|
||||
else if (ct_control_percentage > 50)
|
||||
{
|
||||
g_human_damage_addition = 10.0;
|
||||
PrintToChatAll("CT controll over 50%s of zones. Applying 10%s extra damage", "%", "%");
|
||||
}
|
||||
else
|
||||
{
|
||||
g_human_damage_addition = 1.0;
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void OnClientPutInServer(int client)
|
||||
{
|
||||
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
|
||||
}
|
||||
|
||||
public Action OnTakeDamage(int client, int &attacker, int &inflictor, float &damage, int &damagetype)
|
||||
{
|
||||
if (IsValidClient(attacker) && GetClientTeam(attacker) == CS_TEAM_CT && g_human_damage_addition > 1.0)
|
||||
{
|
||||
//value lower than 1.0 will reduce the actual damage.
|
||||
damage *= g_human_damage_addition;
|
||||
return Plugin_Changed;
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action give_zm_zone_boosts(Handle hTimer)
|
||||
@ -96,6 +167,8 @@ public void OnPluginEnd()
|
||||
CloseHandle(hText);
|
||||
if (g_hZMZoneTimer != null)
|
||||
delete g_hZMZoneTimer;
|
||||
if (g_hZoneCounter != null)
|
||||
delete g_hZoneCounter;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -108,6 +181,7 @@ public void OnClientDisconnect(int client)
|
||||
g_client_in_zone[client] = -1;
|
||||
adjust_clients(); //calling GetClientTeam inside adjust_clients complaints that client already disconnected.
|
||||
g_bBlockRespawn[client] = 0;
|
||||
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
|
||||
}
|
||||
|
||||
public void adjust_clients()
|
||||
@ -170,6 +244,7 @@ public void OnRoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
g_human_damage_addition = 1.0;
|
||||
for (int client = 0; client < MaxClients; client++)
|
||||
{
|
||||
g_bBlockRespawn[client] = 0;
|
||||
@ -249,7 +324,12 @@ public Action ZR_OnClientRespawn(&client, &ZR_RespawnCondition:condition)
|
||||
{
|
||||
if (g_bBlockRespawn[client] > g_hRespawnTreshold.IntValue)
|
||||
return Plugin_Handled;
|
||||
find_teleport_target(client);
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void find_teleport_target(int client)
|
||||
{
|
||||
//teleport player to team members with farthest distance to enemy just.
|
||||
//checking all alive clients to determine which client has highest dist_target to its closest enemy
|
||||
float total_furthest_distance = -1.0;
|
||||
@ -291,7 +371,6 @@ public Action ZR_OnClientRespawn(&client, &ZR_RespawnCondition:condition)
|
||||
client_target[client] = total_nearest;
|
||||
CreateTimer(0.0, tp_client, client);
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
stock int IsPlayerStuck(int client) {
|
||||
@ -531,6 +610,7 @@ public Action ReadZoneFile()
|
||||
|
||||
public void OnMapStart()
|
||||
{
|
||||
g_human_damage_addition = 1.0;
|
||||
//resetting coordinates and setup.
|
||||
for (int i = 0; i < MAXZONES; i++)
|
||||
{
|
||||
@ -868,6 +948,7 @@ public void UpdateMarkers()
|
||||
{
|
||||
g_iZone_fought_or_ct_controlled[i] = 3;
|
||||
//zm controlled zone
|
||||
reward_zm_zone_points(i);
|
||||
handle_pings(i, 3);
|
||||
}
|
||||
}
|
||||
@ -905,7 +986,21 @@ public void UpdateMarkers()
|
||||
}
|
||||
}
|
||||
|
||||
//change to points for zone taker over simply, add gamescore +5 points for zone takeover.
|
||||
public void reward_zm_zone_points(int i)
|
||||
{
|
||||
for (int j = 0; j < MaxClients; j++)
|
||||
{
|
||||
//is validclient, is ct, is alive, is inside the zone that just changed from fought to T controlled
|
||||
if (IsValidClient(j) && GetClientTeam(j) == CS_TEAM_T && IsPlayerAlive(j) && g_client_in_zone[j] == i)
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_simple", false);
|
||||
//rewarding empty zone take over with at least 1 frag
|
||||
int frags = GetClientFrags(j);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void reward_ct_zone_points(int i)
|
||||
{
|
||||
for (int j = 0; j < MaxClients; j++)
|
||||
@ -919,35 +1014,45 @@ public void reward_ct_zone_points(int i)
|
||||
//this should ensure it only counts for what the guy did in damage since the takeover
|
||||
if (damage_done_inside_fought_zone > 0)
|
||||
{
|
||||
int frags = GetClientFrags(j);
|
||||
// Damage 0-1000 inside Zone
|
||||
if (damage_done_inside_fought_zone < 1000)
|
||||
if (damage_done_inside_fought_zone < 200)
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_1", false);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 5);
|
||||
}
|
||||
else if (damage_done_inside_fought_zone < 3000)
|
||||
else if (damage_done_inside_fought_zone < 400)
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_2", false);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 10);
|
||||
}
|
||||
else if (damage_done_inside_fought_zone < 6000)
|
||||
else if (damage_done_inside_fought_zone < 800)
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_3", false);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 15);
|
||||
}
|
||||
else if (damage_done_inside_fought_zone < 9000)
|
||||
else if (damage_done_inside_fought_zone < 1200)
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_4", false);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 20);
|
||||
}
|
||||
else if (damage_done_inside_fought_zone < 15000)
|
||||
else if (damage_done_inside_fought_zone < 1500)
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_5", false);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 25);
|
||||
}
|
||||
else
|
||||
{
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_6", false);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 30);
|
||||
}
|
||||
int frags = GetClientFrags(j);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 5);
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_simple", false);
|
||||
}
|
||||
//this change might be very bad. it might overspam people with points if a zone constantly switches from controlled by CT
|
||||
//to instead be fought over back and forth. but at least it makes it worth it to take over zones.
|
||||
LH_LogPlayerEvent(j, "triggered", "zh_h_zone_take_over_simple", false);
|
||||
//rewarding empty zone take over with at least 1 frag
|
||||
int frags = GetClientFrags(j);
|
||||
SetEntProp(j, Prop_Data, "m_iFrags", frags + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user