cleanup
This commit is contained in:
parent
a184a1f0e4
commit
603c5e5b09
@ -1,150 +0,0 @@
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
|
||||
#define VERSION "1.2.1"
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "Slope Landing Fix",
|
||||
author = "Mev & Blacky",
|
||||
description = "Makes it so landing on a slope will gaurantee a boost.",
|
||||
version = VERSION,
|
||||
url = "http://steamcommunity.com/id/blaackyy/ & http://steamcommunity.com/id/mevv/"
|
||||
}
|
||||
|
||||
float g_vCurrent[MAXPLAYERS + 1][3];
|
||||
float g_vLast[MAXPLAYERS + 1][3];
|
||||
|
||||
bool g_bOnGround[MAXPLAYERS + 1];
|
||||
bool g_bLastOnGround[MAXPLAYERS + 1];
|
||||
|
||||
ConVar g_hSlopeFixEnable;
|
||||
bool g_bSlopeFixEnable;
|
||||
|
||||
public void OnPluginStart()
|
||||
{
|
||||
CreateConVar("slopefix_version", VERSION, "Slope fix version", FCVAR_NOTIFY|FCVAR_REPLICATED);
|
||||
|
||||
g_hSlopeFixEnable = CreateConVar("slopefix_enable", "1", "Enables slope fix.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
|
||||
HookConVarChange(g_hSlopeFixEnable, OnEnableSlopeFixChanged);
|
||||
}
|
||||
|
||||
public void OnConfigsExecuted()
|
||||
{
|
||||
g_bSlopeFixEnable = GetConVarBool(g_hSlopeFixEnable);
|
||||
}
|
||||
|
||||
public OnEnableSlopeFixChanged(Handle:convar, const String:oldValue[], const String:newValue[])
|
||||
{
|
||||
g_bSlopeFixEnable = bool:StringToInt(newValue);
|
||||
}
|
||||
|
||||
public bool TraceRayDontHitSelf(int entity, int mask, any data)
|
||||
{
|
||||
return entity != data && !(0 < entity <= MaxClients);
|
||||
}
|
||||
|
||||
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
|
||||
{
|
||||
if(g_bSlopeFixEnable == true)
|
||||
{
|
||||
g_bLastOnGround[client] = g_bOnGround[client];
|
||||
|
||||
if (GetEntityFlags(client) & FL_ONGROUND)
|
||||
g_bOnGround[client] = true;
|
||||
else
|
||||
g_bOnGround[client] = false;
|
||||
|
||||
g_vLast[client][0] = g_vCurrent[client][0];
|
||||
g_vLast[client][1] = g_vCurrent[client][1];
|
||||
g_vLast[client][2] = g_vCurrent[client][2];
|
||||
g_vCurrent[client][0] = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[0]");
|
||||
g_vCurrent[client][1] = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[1]");
|
||||
g_vCurrent[client][2] = GetEntPropFloat(client, Prop_Send, "m_vecVelocity[2]");
|
||||
|
||||
// Check if player landed on the ground
|
||||
if (g_bOnGround[client] == true && g_bLastOnGround[client] == false)
|
||||
{
|
||||
// Set up and do tracehull to find out if the player landed on a slope
|
||||
float vPos[3];
|
||||
GetEntPropVector(client, Prop_Data, "m_vecOrigin", vPos);
|
||||
|
||||
float vMins[3];
|
||||
GetEntPropVector(client, Prop_Send, "m_vecMins", vMins);
|
||||
|
||||
float vMaxs[3];
|
||||
GetEntPropVector(client, Prop_Send, "m_vecMaxs", vMaxs);
|
||||
|
||||
float vEndPos[3];
|
||||
vEndPos[0] = vPos[0];
|
||||
vEndPos[1] = vPos[1];
|
||||
vEndPos[2] = vPos[2] - FindConVar("sv_maxvelocity").FloatValue;
|
||||
|
||||
TR_TraceHullFilter(vPos, vEndPos, vMins, vMaxs, MASK_PLAYERSOLID_BRUSHONLY, TraceRayDontHitSelf, client);
|
||||
|
||||
if(TR_DidHit())
|
||||
{
|
||||
// Gets the normal vector of the surface under the player
|
||||
float vPlane[3], vLast[3];
|
||||
TR_GetPlaneNormal(INVALID_HANDLE, vPlane);
|
||||
|
||||
// Make sure it's not flat ground and not a surf ramp (1.0 = flat ground, < 0.7 = surf ramp)
|
||||
if(0.7 <= vPlane[2] < 1.0)
|
||||
{
|
||||
/*
|
||||
Copy the ClipVelocity function from sdk2013
|
||||
(https://mxr.alliedmods.net/hl2sdk-sdk2013/source/game/shared/gamemovement.cpp#3145)
|
||||
With some minor changes to make it actually work
|
||||
*/
|
||||
vLast[0] = g_vLast[client][0];
|
||||
vLast[1] = g_vLast[client][1];
|
||||
vLast[2] = g_vLast[client][2];
|
||||
vLast[2] -= (FindConVar("sv_gravity").FloatValue * GetTickInterval() * 0.5);
|
||||
|
||||
float fBackOff = GetVectorDotProduct(vLast, vPlane);
|
||||
|
||||
float change, vVel[3];
|
||||
for(int i; i < 2; i++)
|
||||
{
|
||||
change = vPlane[i] * fBackOff;
|
||||
vVel[i] = vLast[i] - change;
|
||||
}
|
||||
|
||||
float fAdjust = GetVectorDotProduct(vVel, vPlane);
|
||||
if(fAdjust < 0.0)
|
||||
{
|
||||
for(int i; i < 2; i++)
|
||||
{
|
||||
vVel[i] -= (vPlane[i] * fAdjust);
|
||||
}
|
||||
}
|
||||
|
||||
vVel[2] = 0.0;
|
||||
vLast[2] = 0.0;
|
||||
|
||||
// Make sure the player is going down a ramp by checking if they actually will gain speed from the boost
|
||||
if(GetVectorLength(vVel) > GetVectorLength(vLast))
|
||||
SetClientVelocity(client, vVel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
stock void SetClientVelocity(int client, float vVelocity[3])
|
||||
{
|
||||
static bool GotOffset = false;
|
||||
static int Offset = -1;
|
||||
|
||||
if(!GotOffset)
|
||||
{
|
||||
Offset = FindDataMapInfo(client, "m_vecAbsVelocity");
|
||||
GotOffset = true;
|
||||
}
|
||||
|
||||
// Apply velocity on client.
|
||||
if(Offset != -1) // Fixes trigger OnStartTouch/OnEndTouch bug
|
||||
SetEntDataVector(client, Offset, vVelocity);
|
||||
else // Fallback to old one
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, vVelocity);
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
../zr_tools/scripting/include/zr_tools.inc
|
@ -1,90 +0,0 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <zombiereloaded>
|
||||
|
||||
#define PLUGIN_NAME "ZR Repeat Kill Detector"
|
||||
#define PLUGIN_VERSION "1.0.3"
|
||||
|
||||
new Handle:g_hCvar_RepeatKillDetectThreshold = INVALID_HANDLE;
|
||||
new Float:g_fRepeatKillDetectThreshold;
|
||||
|
||||
new Handle:g_hRespawnDelay = INVALID_HANDLE;
|
||||
new Float:g_fDeathTime[MAXPLAYERS+1];
|
||||
new bool:g_bBlockRespawn = false;
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = PLUGIN_NAME,
|
||||
author = "GoD-Tony + BotoX",
|
||||
description = "Disables respawning on maps with repeat killers",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "http://www.sourcemod.net/"
|
||||
};
|
||||
|
||||
public OnAllPluginsLoaded()
|
||||
{
|
||||
if((g_hRespawnDelay = FindConVar("zr_respawn_delay")) == INVALID_HANDLE)
|
||||
SetFailState("Failed to find zr_respawn_delay cvar.");
|
||||
|
||||
g_hCvar_RepeatKillDetectThreshold = CreateConVar("zr_repeatkill_threshold", "1.0", "Zombie Reloaded Repeat Kill Detector Threshold", 0, true, 0.0, true, 10.0);
|
||||
g_fRepeatKillDetectThreshold = GetConVarFloat(g_hCvar_RepeatKillDetectThreshold);
|
||||
HookConVarChange(g_hCvar_RepeatKillDetectThreshold, OnConVarChanged);
|
||||
|
||||
CreateConVar("zr_repeatkill_version", PLUGIN_VERSION, PLUGIN_NAME, FCVAR_NOTIFY|FCVAR_DONTRECORD);
|
||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||
HookEvent("player_death", Event_PlayerDeath, EventHookMode_Post);
|
||||
|
||||
AutoExecConfig(true, "plugin.RepeatKillDetector");
|
||||
}
|
||||
|
||||
public OnConVarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
|
||||
{
|
||||
if(cvar == g_hCvar_RepeatKillDetectThreshold)
|
||||
{
|
||||
g_fRepeatKillDetectThreshold = GetConVarFloat(g_hCvar_RepeatKillDetectThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
public OnClientDisconnect(client)
|
||||
{
|
||||
g_fDeathTime[client] = 0.0;
|
||||
}
|
||||
|
||||
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
g_bBlockRespawn = false;
|
||||
}
|
||||
|
||||
public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
if(g_bBlockRespawn)
|
||||
return;
|
||||
|
||||
decl String:weapon[32];
|
||||
GetEventString(event, "weapon", weapon, sizeof(weapon));
|
||||
|
||||
new victim = GetClientOfUserId(GetEventInt(event, "userid"));
|
||||
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
|
||||
|
||||
if(victim && !attacker && StrEqual(weapon, "trigger_hurt"))
|
||||
{
|
||||
new Float:fGameTime = GetGameTime();
|
||||
|
||||
if(fGameTime - g_fDeathTime[victim] - GetConVarFloat(g_hRespawnDelay) < g_fRepeatKillDetectThreshold)
|
||||
{
|
||||
PrintToChatAll("\x04[ZR]\x01 Repeat killer detected. Disabling respawn for this round.");
|
||||
g_bBlockRespawn = true;
|
||||
}
|
||||
|
||||
g_fDeathTime[victim] = fGameTime;
|
||||
}
|
||||
}
|
||||
|
||||
public Action:ZR_OnClientRespawn(&client, &ZR_RespawnCondition:condition)
|
||||
{
|
||||
if(g_bBlockRespawn)
|
||||
return Plugin_Handled;
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
/* Zombie:Reloaded additional native tools
|
||||
*
|
||||
* Copyright © 2013, FrozDark
|
||||
*
|
||||
* This file is provided as is (no warranties).
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gets client class section name in the config
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param buffer Buffer to store the class section name in.
|
||||
* @param maxlen Max length to store.
|
||||
*
|
||||
* @return Number of bytes written to the buffer.
|
||||
* @error If the client is not in game or invalid.
|
||||
*/
|
||||
native ZRT_GetClientClassSectionName(client, String:buffer[], maxlen);
|
||||
|
||||
/**
|
||||
* Gets attribute string of the player's class
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param attrib Attribute name.
|
||||
* @param buffer Buffer to store the attribute string in.
|
||||
* @param maxlen Max length to store.
|
||||
* @param defvalue Optional default value to use if the attribute is not found.
|
||||
*
|
||||
* @return Number of bytes written to the buffer.
|
||||
* @error If the client is not in game or invalid.
|
||||
*/
|
||||
native ZRT_GetClientAttributeString(client, const String:attrib[], String:buffer[], maxlen, const String:defvalue[] = "");
|
||||
|
||||
/**
|
||||
* Gets attribute numeric value of the player's class
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param attrib Attribute name.
|
||||
* @param defvalue Optional default value to use if the attribute is not found.
|
||||
*
|
||||
* @return Retrieves the numeric value.
|
||||
* @error If the client is not in game or invalid.
|
||||
*/
|
||||
native ZRT_GetClientAttributeValue(client, const String:attrib[], defvalue = 0);
|
||||
|
||||
/**
|
||||
* Gets attribute floating value of the player's class
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param attrib Attribute name.
|
||||
* @param defvalue Optional default value to use if the attribute is not found.
|
||||
*
|
||||
* @return Retrieves the floating value.
|
||||
* @error If the client is not in game or invalid.
|
||||
*/
|
||||
native Float:ZRT_GetClientAttributeValueFloat(client, const String:attrib[], Float:defvalue = 0.0);
|
||||
|
||||
/**
|
||||
* Whether the player has attribute
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param attrib Attribute name.
|
||||
*
|
||||
* @return True on success, false otherwise.
|
||||
* @error If the client is not in game or invalid.
|
||||
*/
|
||||
native bool:ZRT_PlayerHasAttribute(client, const String:attrib[]);
|
||||
|
||||
/**
|
||||
* Whether the round is active
|
||||
*
|
||||
* @noparams
|
||||
*
|
||||
* @return True on round active, false otherwise
|
||||
* @noerror
|
||||
*/
|
||||
native bool:ZRT_IsRoundActive();
|
||||
|
||||
|
||||
|
||||
|
||||
/*----------------------------------
|
||||
***********************************
|
||||
** Don't edit below this line! **
|
||||
***********************************
|
||||
-----------------------------------*/
|
||||
|
||||
public SharedPlugin:__pl_zr_tools =
|
||||
{
|
||||
name = "zr_tools",
|
||||
file = "zr_tools.smx",
|
||||
#if defined REQUIRE_PLUGIN
|
||||
required = 1,
|
||||
#else
|
||||
required = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !defined REQUIRE_PLUGIN
|
||||
public __pl_zr_tools_SetNTVOptional()
|
||||
{
|
||||
MarkNativeAsOptional("ZRT_GetClientClassSectionName");
|
||||
MarkNativeAsOptional("ZRT_GetClientAttributeString");
|
||||
MarkNativeAsOptional("ZRT_GetClientAttributeValue");
|
||||
MarkNativeAsOptional("ZRT_GetClientAttributeValueFloat");
|
||||
MarkNativeAsOptional("ZRT_PlayerHasAttribute");
|
||||
MarkNativeAsOptional("ZRT_IsRoundActive");
|
||||
}
|
||||
#endif
|
@ -1,271 +0,0 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <zombiereloaded>
|
||||
|
||||
#define PLUGIN_VERSION "1.6.1"
|
||||
|
||||
new Handle:kv;
|
||||
new Handle:hPlayerClasses, String:sClassPath[PLATFORM_MAX_PATH] = "configs/zr/playerclasses.txt";
|
||||
new bool:g_RoundEnd = false;
|
||||
|
||||
public Plugin:myinfo =
|
||||
{
|
||||
name = "[ZR] Tools",
|
||||
author = "FrozDark",
|
||||
description = "Useful tools for Zombie:Reloaded",
|
||||
version = PLUGIN_VERSION,
|
||||
url = "www.hlmod.ru"
|
||||
}
|
||||
|
||||
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
|
||||
{
|
||||
CreateNative("ZRT_GetClientClassSectionName", Native_GetClientClassSectionName);
|
||||
CreateNative("ZRT_GetClientAttributeString", Native_GetClientAttributeString);
|
||||
CreateNative("ZRT_GetClientAttributeValue", Native_GetClientAttributeValue);
|
||||
CreateNative("ZRT_GetClientAttributeValueFloat", Native_GetClientAttributeValueFloat);
|
||||
CreateNative("ZRT_PlayerHasAttribute", Native_PlayerHasAttribute);
|
||||
CreateNative("ZRT_IsRoundActive", Native_IsRoundActive);
|
||||
|
||||
RegPluginLibrary("zr_tools");
|
||||
|
||||
return APLRes_Success;
|
||||
}
|
||||
|
||||
public OnPluginStart()
|
||||
{
|
||||
CreateConVar("zr_tools_version", PLUGIN_VERSION, "Zombie:Reloaded tools plugin version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_CHEAT|FCVAR_DONTRECORD);
|
||||
|
||||
RegAdminCmd("zr_tools_reload", Command_Reload, ADMFLAG_ROOT);
|
||||
|
||||
HookEvent("round_start", Event_RoundStart);
|
||||
HookEvent("round_end", Event_RoundEnd);
|
||||
}
|
||||
|
||||
public OnAllPluginsLoaded()
|
||||
{
|
||||
if (hPlayerClasses != INVALID_HANDLE)
|
||||
{
|
||||
UnhookConVarChange(hPlayerClasses, OnClassPathChange);
|
||||
CloseHandle(hPlayerClasses);
|
||||
}
|
||||
if ((hPlayerClasses = FindConVar("zr_config_path_playerclasses")) == INVALID_HANDLE)
|
||||
{
|
||||
SetFailState("Zombie:Reloaded is not running on this server");
|
||||
}
|
||||
HookConVarChange(hPlayerClasses, OnClassPathChange);
|
||||
}
|
||||
|
||||
public OnClassPathChange(Handle:convar, const String:oldValue[], const String:newValue[])
|
||||
{
|
||||
strcopy(sClassPath, sizeof(sClassPath), newValue);
|
||||
OnConfigsExecuted();
|
||||
}
|
||||
|
||||
public OnConfigsExecuted()
|
||||
{
|
||||
if (kv != INVALID_HANDLE)
|
||||
{
|
||||
CloseHandle(kv);
|
||||
}
|
||||
kv = CreateKeyValues("classes");
|
||||
|
||||
decl String:buffer[PLATFORM_MAX_PATH];
|
||||
BuildPath(Path_SM, buffer, sizeof(buffer), "%s", sClassPath);
|
||||
|
||||
if (!FileToKeyValues(kv, buffer))
|
||||
{
|
||||
SetFailState("Class data file \"%s\" not found", buffer);
|
||||
}
|
||||
}
|
||||
|
||||
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
g_RoundEnd = false;
|
||||
}
|
||||
|
||||
public Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
|
||||
{
|
||||
g_RoundEnd = true;
|
||||
}
|
||||
|
||||
public Action:Command_Reload(client, args)
|
||||
{
|
||||
OnConfigsExecuted();
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Native_IsRoundActive(Handle:plugin, numParams)
|
||||
{
|
||||
return !g_RoundEnd;
|
||||
}
|
||||
|
||||
public Native_PlayerHasAttribute(Handle:plugin, numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
ValidateClient(client);
|
||||
|
||||
decl String:attrib[32];
|
||||
GetNativeString(2, attrib, sizeof(attrib));
|
||||
|
||||
decl String:className[64], String:buffer[64];
|
||||
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
|
||||
|
||||
new bool:result = false;
|
||||
if (KvGotoFirstSubKey(kv))
|
||||
{
|
||||
do
|
||||
{
|
||||
KvGetString(kv, "name", buffer, sizeof(buffer));
|
||||
if (StrEqual(buffer, className, false))
|
||||
{
|
||||
KvGetString(kv, attrib, buffer, sizeof(buffer), "0");
|
||||
|
||||
result = bool:(StrContains("yes|1|true", buffer, false) != -1);
|
||||
break;
|
||||
}
|
||||
} while (KvGotoNextKey(kv));
|
||||
}
|
||||
KvRewind(kv);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Native_GetClientAttributeString(Handle:plugin, numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
ValidateClient(client);
|
||||
|
||||
decl String:attrib[32];
|
||||
GetNativeString(2, attrib, sizeof(attrib));
|
||||
|
||||
decl String:className[64], String:buffer[PLATFORM_MAX_PATH];
|
||||
buffer[0] = '\0';
|
||||
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
|
||||
|
||||
new bytes;
|
||||
if (KvGotoFirstSubKey(kv))
|
||||
{
|
||||
do
|
||||
{
|
||||
KvGetString(kv, "name", buffer, sizeof(buffer));
|
||||
if (StrEqual(buffer, className, false))
|
||||
{
|
||||
KvGetString(kv, attrib, buffer, sizeof(buffer), "");
|
||||
|
||||
SetNativeString(3, buffer, GetNativeCell(4), true, bytes);
|
||||
break;
|
||||
}
|
||||
} while (KvGotoNextKey(kv));
|
||||
}
|
||||
KvRewind(kv);
|
||||
|
||||
if (!buffer[0])
|
||||
{
|
||||
GetNativeString(5, buffer, sizeof(buffer));
|
||||
SetNativeString(3, buffer, GetNativeCell(4), true, bytes);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public Native_GetClientAttributeValue(Handle:plugin, numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
ValidateClient(client);
|
||||
|
||||
decl String:attrib[32];
|
||||
GetNativeString(2, attrib, sizeof(attrib));
|
||||
|
||||
decl String:className[64], String:buffer[PLATFORM_MAX_PATH];
|
||||
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
|
||||
|
||||
new result = -1;
|
||||
|
||||
if (KvGotoFirstSubKey(kv))
|
||||
{
|
||||
do
|
||||
{
|
||||
KvGetString(kv, "name", buffer, sizeof(buffer));
|
||||
if (StrEqual(buffer, className, false))
|
||||
{
|
||||
result = KvGetNum(kv, attrib, GetNativeCell(3));
|
||||
break;
|
||||
}
|
||||
} while (KvGotoNextKey(kv));
|
||||
}
|
||||
KvRewind(kv);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public Native_GetClientAttributeValueFloat(Handle:plugin, numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
ValidateClient(client);
|
||||
|
||||
decl String:attrib[32];
|
||||
GetNativeString(2, attrib, sizeof(attrib));
|
||||
|
||||
decl String:className[64], String:buffer[PLATFORM_MAX_PATH];
|
||||
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
|
||||
|
||||
new Float:result = -1.0;
|
||||
|
||||
if (KvGotoFirstSubKey(kv))
|
||||
{
|
||||
do
|
||||
{
|
||||
KvGetString(kv, "name", buffer, sizeof(buffer));
|
||||
if (StrEqual(buffer, className, false))
|
||||
{
|
||||
result = KvGetFloat(kv, attrib, Float:GetNativeCell(3));
|
||||
break;
|
||||
}
|
||||
} while (KvGotoNextKey(kv));
|
||||
}
|
||||
KvRewind(kv);
|
||||
|
||||
return _:result;
|
||||
}
|
||||
|
||||
public Native_GetClientClassSectionName(Handle:plugin, numParams)
|
||||
{
|
||||
new client = GetNativeCell(1);
|
||||
ValidateClient(client);
|
||||
|
||||
decl String:className[64], String:buffer[64];
|
||||
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
|
||||
|
||||
new bytes;
|
||||
if (KvGotoFirstSubKey(kv))
|
||||
{
|
||||
do
|
||||
{
|
||||
KvGetString(kv, "name", buffer, sizeof(buffer));
|
||||
if (StrEqual(buffer, className, false))
|
||||
{
|
||||
KvGetSectionName(kv, buffer, sizeof(buffer));
|
||||
|
||||
SetNativeString(2, buffer, GetNativeCell(3), true, bytes);
|
||||
break;
|
||||
}
|
||||
} while (KvGotoNextKey(kv));
|
||||
}
|
||||
KvRewind(kv);
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
ValidateClient(client)
|
||||
{
|
||||
if (client < 1 || client > MaxClients)
|
||||
{
|
||||
ThrowNativeError(SP_ERROR_INDEX, "Client index %i is invalid", client);
|
||||
return;
|
||||
}
|
||||
else if (!IsClientInGame(client))
|
||||
{
|
||||
ThrowNativeError(SP_ERROR_NOT_FOUND, "Client %i is not in game", client);
|
||||
return;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user