forked from UNLOZE/sm-plugins
cleanup
This commit is contained in:
@@ -1,142 +0,0 @@
|
||||
#include <sourcemod>
|
||||
#include <cstrike>
|
||||
#include <zombiereloaded>
|
||||
|
||||
bool G_bIsHuman[MAXPLAYERS+1];
|
||||
bool G_bIsZombie[MAXPLAYERS+1];
|
||||
|
||||
ConVar G_hCvar_Difficulty_Humans;
|
||||
ConVar G_hCvar_Difficulty_Zombies;
|
||||
ConVar G_hCvar_Difficulty_Humans_BlockTime;
|
||||
|
||||
Handle g_hHumanPointsTimer;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "HLstatsX CE Difficulty",
|
||||
author = "zaCade + Neon",
|
||||
description = "Grant points to the winning team. (zombies/humans)",
|
||||
version = "1.2",
|
||||
url = ""
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public OnPluginStart()
|
||||
{
|
||||
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_Humans_BlockTime = CreateConVar("hlx_difficulty_humans_blocktime", "60", "", 0, true, 0.0, true, 180.0);
|
||||
|
||||
HookEvent("round_start", Event_RoundStart);
|
||||
HookEvent("round_end", Event_RoundEnd);
|
||||
|
||||
AutoExecConfig(true, "plugin.hlstatsx_difficulty");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public ZR_OnClientInfected(client, attacker, bool:motherinfect, bool:respawnoverride, bool:respawn)
|
||||
{
|
||||
G_bIsHuman[client] = false;
|
||||
G_bIsZombie[client] = true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public ZR_OnClientHumanPost(client, bool:respawn, bool:protect)
|
||||
{
|
||||
G_bIsHuman[client] = true;
|
||||
G_bIsZombie[client] = false;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action:Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
if (g_hHumanPointsTimer != INVALID_HANDLE && KillTimer(g_hHumanPointsTimer))
|
||||
g_hHumanPointsTimer = INVALID_HANDLE;
|
||||
|
||||
g_hHumanPointsTimer = CreateTimer(G_hCvar_Difficulty_Humans_BlockTime.FloatValue, OnHumanPointsTimer);
|
||||
|
||||
for (new client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
G_bIsHuman[client] = true;
|
||||
G_bIsZombie[client] = false;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
switch(GetEventInt(event, "winner"))
|
||||
{
|
||||
case(CS_TEAM_CT): CreateTimer(0.2, OnHumansWin, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
case(CS_TEAM_T): CreateTimer(0.2, OnZombiesWin, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action OnHumanPointsTimer(Handle timer)
|
||||
{
|
||||
g_hHumanPointsTimer = INVALID_HANDLE;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action:OnHumansWin(Handle:timer)
|
||||
{
|
||||
if (g_hHumanPointsTimer != INVALID_HANDLE)
|
||||
{
|
||||
PrintToChatAll("[SM] Round ended too fast. Humans will not be rewarded for the Win.");
|
||||
return;
|
||||
}
|
||||
|
||||
for (new client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
|
||||
{
|
||||
if (G_bIsHuman[client] && !G_bIsZombie[client])
|
||||
{
|
||||
new String:sAuthid[64];
|
||||
if (!GetClientAuthString(client, sAuthid, sizeof(sAuthid)))
|
||||
Format(sAuthid, sizeof(sAuthid), "UNKNOWN");
|
||||
|
||||
LogToGame("\"%N<%d><%s><%s>\" triggered \"human_win_%i\"", client, GetClientUserId(client), sAuthid, "CT", G_hCvar_Difficulty_Humans.IntValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action:OnZombiesWin(Handle:timer)
|
||||
{
|
||||
for (new client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (IsClientInGame(client) && IsPlayerAlive(client) && !IsClientObserver(client) && !IsFakeClient(client))
|
||||
{
|
||||
if (G_bIsZombie[client] && !G_bIsHuman[client])
|
||||
{
|
||||
new String:sAuthid[64];
|
||||
if (!GetClientAuthString(client, sAuthid, sizeof(sAuthid)))
|
||||
Format(sAuthid, sizeof(sAuthid), "UNKNOWN");
|
||||
|
||||
LogToGame("\"%N<%d><%s><%s>\" triggered \"zombie_win_%i\"", client, GetClientUserId(client), sAuthid, "TERRORIST", G_hCvar_Difficulty_Zombies.IntValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
#include <loghelper>
|
||||
#include <sourcemod>
|
||||
#include <zriot>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
/* CONVARS */
|
||||
ConVar g_cvarStreakInterval = null;
|
||||
ConVar g_cvarMinimumStreak = null;
|
||||
ConVar g_cvarMaximumStreak = null;
|
||||
|
||||
/* INTERGERS */
|
||||
int g_iKillCount[MAXPLAYERS+1] = 0;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "HLstatsX CE - Zombie Riot",
|
||||
author = "zaCade",
|
||||
description = "Create additional actions for the default HLstatsX",
|
||||
version = "1.0.0"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnPluginStart()
|
||||
{
|
||||
g_cvarStreakInterval = CreateConVar("hlx_zr_killstreaks_interval", "10", "amount of kills required to progress to the next killstreak", 0, true, 1.0);
|
||||
g_cvarMinimumStreak = CreateConVar("hlx_zr_killstreaks_minimal", "10", "amount of kills required for the lowest killstreak", 0, true, 0.0);
|
||||
g_cvarMaximumStreak = CreateConVar("hlx_zr_killstreaks_maximal", "200", "amount of kills required for the highest killstreak", 0, true, 0.0);
|
||||
|
||||
HookEvent("round_end", OnRoundEnding, EventHookMode_Pre);
|
||||
HookEvent("player_spawn", OnClientSpawn, EventHookMode_Pre);
|
||||
HookEvent("player_death", OnClientDeath, EventHookMode_Pre);
|
||||
|
||||
AutoExecConfig();
|
||||
GetTeams();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnMapStart()
|
||||
{
|
||||
GetTeams();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnRoundEnding(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (IsValidClient(client))
|
||||
{
|
||||
EndKillStreak(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientSpawn(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
int client = GetClientOfUserId(hEvent.GetInt("userid"));
|
||||
|
||||
ResetClient(client);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
int client = GetClientOfUserId(hEvent.GetInt("userid"));
|
||||
int killer = GetClientOfUserId(hEvent.GetInt("attacker"));
|
||||
|
||||
EndKillStreak(client);
|
||||
|
||||
if (IsValidClient(killer))
|
||||
{
|
||||
g_iKillCount[killer] += 1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
ResetClient(client);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void EndKillStreak(int client)
|
||||
{
|
||||
if (g_iKillCount[client] >= g_cvarMinimumStreak.IntValue)
|
||||
{
|
||||
if (g_iKillCount[client] > g_cvarMaximumStreak.IntValue)
|
||||
g_iKillCount[client] = g_cvarMaximumStreak.IntValue;
|
||||
|
||||
char sPlayerEvent[32];
|
||||
Format(sPlayerEvent, sizeof(sPlayerEvent), "zr_kill_streak_%d", RoundToFloor(float(g_iKillCount[client]) / float(g_cvarStreakInterval.IntValue)) * g_cvarStreakInterval.IntValue);
|
||||
|
||||
LogPlayerEvent(client, "triggered", sPlayerEvent);
|
||||
}
|
||||
|
||||
ResetClient(client);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock void ResetClient(int client)
|
||||
{
|
||||
g_iKillCount[client] = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
stock bool IsValidClient(int client)
|
||||
{
|
||||
return (client > 0 && client <= MaxClients && IsClientInGame(client) && IsPlayerAlive(client));
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
#include <sourcemod>
|
||||
#include <cstrike>
|
||||
|
||||
ConVar g_Cvar_HlxBonusHuman;
|
||||
ConVar g_Cvar_HlxBonusZombie;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "SuperLogs: Z:R",
|
||||
author = "BotoX",
|
||||
description = "HLstatsX CE Zombie:Reloaded extension",
|
||||
version = "1.0",
|
||||
url = ""
|
||||
};
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
g_Cvar_HlxBonusHuman = CreateConVar("hlx_bonus_human", "0", "", 0, true, 0.0, true, 1000.0);
|
||||
g_Cvar_HlxBonusZombie = CreateConVar("hlx_bonus_zombie", "0", "", 0, true, 0.0, true, 1000.0);
|
||||
|
||||
HookEvent("round_end", Event_RoundEnd, EventHookMode_Pre);
|
||||
|
||||
AutoExecConfig(true, "plugin.superlogs-zr");
|
||||
}
|
||||
|
||||
public void Event_RoundEnd(Event hEvent, const char[] sEvent, bool bDontBroadcast)
|
||||
{
|
||||
switch(hEvent.GetInt("winner"))
|
||||
{
|
||||
case(CS_TEAM_CT):
|
||||
{
|
||||
LogToGame("Team \"CT\" triggered \"Humans_Win\" (hlx_team_bonuspoints \"%d\")", g_Cvar_HlxBonusHuman.IntValue);
|
||||
}
|
||||
case(CS_TEAM_T):
|
||||
{
|
||||
LogToGame("Team \"TERRORIST\" triggered \"Zombies_Win\" (hlx_team_bonuspoints \"%d\")", g_Cvar_HlxBonusZombie.IntValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user