hlstatsx_difficulty: dont reward humans if they win during the first X seconds
This commit is contained in:
parent
96c33fb0eb
commit
56e72fff93
@ -7,6 +7,10 @@ new bool:G_bIsZombie[MAXPLAYERS+1];
|
|||||||
|
|
||||||
new Handle:G_hCvar_Difficulty_Humans;
|
new Handle:G_hCvar_Difficulty_Humans;
|
||||||
new Handle:G_hCvar_Difficulty_Zombies;
|
new Handle:G_hCvar_Difficulty_Zombies;
|
||||||
|
new Handle:G_hCvar_Difficulty_Humans_BlockTime;
|
||||||
|
|
||||||
|
bool g_bHumanPointsEnabled = false;
|
||||||
|
Handle g_hTimer = INVALID_HANDLE;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
@ -16,7 +20,7 @@ public Plugin:myinfo =
|
|||||||
name = "HLstatsX CE Difficulty",
|
name = "HLstatsX CE Difficulty",
|
||||||
author = "zaCade + Neon",
|
author = "zaCade + Neon",
|
||||||
description = "Grant points to the winning team. (zombies/humans)",
|
description = "Grant points to the winning team. (zombies/humans)",
|
||||||
version = "1.1",
|
version = "1.2",
|
||||||
url = ""
|
url = ""
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -27,6 +31,7 @@ public OnPluginStart()
|
|||||||
{
|
{
|
||||||
G_hCvar_Difficulty_Humans = CreateConVar("hlx_difficulty_humans", "0", "", 0, true, 0.0, true, 3.0);
|
G_hCvar_Difficulty_Humans = CreateConVar("hlx_difficulty_humans", "0", "", 0, true, 0.0, true, 3.0);
|
||||||
G_hCvar_Difficulty_Zombies = CreateConVar("hlx_difficulty_zombies", "0", "", 0, true, 0.0, true, 3.0);
|
G_hCvar_Difficulty_Zombies = CreateConVar("hlx_difficulty_zombies", "0", "", 0, true, 0.0, true, 3.0);
|
||||||
|
G_hCvar_Difficulty_Humans_BlockTime = CreateConVar("hlx_difficulty_humans_blocktime", "60", "", 0, true, 0.0, true, 180.0);
|
||||||
|
|
||||||
HookEvent("round_start", Event_RoundStart);
|
HookEvent("round_start", Event_RoundStart);
|
||||||
HookEvent("round_end", Event_RoundEnd);
|
HookEvent("round_end", Event_RoundEnd);
|
||||||
@ -57,6 +62,14 @@ public ZR_OnClientHumanPost(client, bool:respawn, bool:protect)
|
|||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||||
{
|
{
|
||||||
|
if (g_hTimer != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
KillTimer(g_hTimer);
|
||||||
|
g_hTimer = INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
g_bHumanPointsEnabled = false;
|
||||||
|
g_hTimer = CreateTimer(GetConVarFloat(G_hCvar_Difficulty_Humans_BlockTime), EnableHumanPoints, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||||
|
|
||||||
for (new client = 1; client <= MaxClients; client++)
|
for (new client = 1; client <= MaxClients; client++)
|
||||||
{
|
{
|
||||||
G_bIsHuman[client] = true;
|
G_bIsHuman[client] = true;
|
||||||
@ -76,11 +89,25 @@ public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadca
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
// Purpose:
|
||||||
|
//----------------------------------------------------------------------------------------------------
|
||||||
|
public Action EnableHumanPoints(Handle timer)
|
||||||
|
{
|
||||||
|
g_bHumanPointsEnabled = true;
|
||||||
|
g_hTimer = INVALID_HANDLE;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public Action:OnHumansWin(Handle:timer)
|
public Action:OnHumansWin(Handle:timer)
|
||||||
{
|
{
|
||||||
|
if (!g_bHumanPointsEnabled)
|
||||||
|
{
|
||||||
|
PrintToChatAll("[SM] Round ended too fast. Humans will not be rewarded for the Win.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (new client = 1; client <= MaxClients; client++)
|
for (new client = 1; client <= MaxClients; client++)
|
||||||
{
|
{
|
||||||
if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
|
if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
|
||||||
|
Loading…
Reference in New Issue
Block a user