parent
16ee25f3ff
commit
3021aae14e
@ -9,7 +9,7 @@ float g_fDeathTime[MAXPLAYERS+1];
|
||||
|
||||
/* CONVARS */
|
||||
ConVar g_hRespawnDelay;
|
||||
ConVar g_hRespawnTreshold; //Test
|
||||
ConVar g_hRespawnTreshold;
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@ -30,12 +30,12 @@ public void OnPluginStart()
|
||||
{
|
||||
if((g_hRespawnDelay = FindConVar("zr_respawn_delay")) == INVALID_HANDLE)
|
||||
SetFailState("Failed to find zr_respawn_delay cvar.");
|
||||
|
||||
|
||||
g_hRespawnTreshold = CreateConVar("zr_repeatkill_threshold", "1.0", "Zombie Reloaded Repeat Kill Detector Threshold", 0, true, 0.0, true, 10.0);
|
||||
|
||||
|
||||
HookEvent("round_start", OnRoundStart);
|
||||
HookEvent("player_death", OnClientDeath);
|
||||
|
||||
|
||||
AutoExecConfig(true, "plugin.RepeatKillDetector");
|
||||
}
|
||||
|
||||
@ -64,23 +64,23 @@ public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast
|
||||
{
|
||||
char sWeapon[32];
|
||||
hEvent.GetString("weapon", sWeapon, sizeof(sWeapon))
|
||||
|
||||
|
||||
int victim = GetClientOfUserId(hEvent.GetInt("userid"));
|
||||
int client = GetClientOfUserId(hEvent.GetInt("attacker"));
|
||||
|
||||
|
||||
if (g_bBlockRespawn[victim])
|
||||
return;
|
||||
|
||||
|
||||
if (victim && !client && StrEqual(sWeapon, "trigger_hurt"))
|
||||
{
|
||||
float fGameTime = GetGameTime();
|
||||
|
||||
|
||||
if (fGameTime - g_fDeathTime[victim] - g_hRespawnDelay.FloatValue <= g_hRespawnTreshold.FloatValue)
|
||||
{
|
||||
PrintToChat(victim, "\x04[ZR]\x01 Repeat killer detected. Disabling your respawn for this round.");
|
||||
g_bBlockRespawn[victim] = true;
|
||||
}
|
||||
|
||||
|
||||
g_fDeathTime[victim] = fGameTime;
|
||||
}
|
||||
}
|
||||
@ -92,6 +92,6 @@ public Action ZR_OnClientRespawn(&client, &ZR_RespawnCondition:condition)
|
||||
{
|
||||
if (g_bBlockRespawn[client])
|
||||
return Plugin_Handled;
|
||||
|
||||
|
||||
return Plugin_Continue;
|
||||
}
|
1
secrets
Submodule
1
secrets
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e0dfc41273433d455c61411d3c2761f317b72244
|
Loading…
Reference in New Issue
Block a user