
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
C | size: 1.66 KB | hits: 24 | expires: Never
#include <sourcemod>
#include <timers>
#include <sdkhooks>
public Plugin:myinfo =
{
name = "De-TripleSlice",
author = "Reevezy",
description = "Will take 4 hits to kill as hidden unless hits are spaced out",
version = "1.0.0.0",
url = "http://www.sourcemod.net/"
};
new Victim;
new sameClientCount = 0;
//new Health = 0;
new Handle:hsm_handicap
new HandicapValue
public OnPluginStart()
{
hsm_handicap = FindConVar("hsm_handicap_damagereduction");
HandicapValue = GetConVarInt(hsm_handicap);
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
OnClientPutInServer(i);
}
}
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if(GetClientTeam(inflictor) == 3 && HandicapValue == 0)
{
if(sameClientCount==0)
{
CreateTimer(3.0, CountToZero);
}
if(THit(Victim)) //If victim has been hit twice already.
{
//Health = GetClientHealth(Victim);
//SetEntityHealth(Victim, (Health - 20));
//damage = 20.0;
//return Plugin_Changed;
SetEntityHealth(Victim, GetClientHealth(victim) + 17);
PrintToChat(inflictor, "Damage reduced from knife spam.");
}
Victim = GetClientOfUserId(victim);
}
return Plugin_Continue;
}
public Action:CountToZero(Handle:timer)
{
sameClientCount = 0;
}
public bool:THit(vi)
{
if(Victim == vi)
{
sameClientCount++;
if(sameClientCount > 2)
{
return true;
}
}
else
{
sameClientCount = 0;
}
return false;
}