mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 02:53:21 +00:00
TKStopper: Change logic
This commit is contained in:
parent
f91a704e08
commit
2e7715e72f
2 changed files with 13 additions and 12 deletions
Binary file not shown.
|
@ -80,11 +80,11 @@ public void OnClientDisconnect(int client) {
|
||||||
//TODO: Autopunish on troll instead of ban. Activate troll that does 0 damage from their guns & xswarm
|
//TODO: Autopunish on troll instead of ban. Activate troll that does 0 damage from their guns & xswarm
|
||||||
|
|
||||||
public Action Event_OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
|
public Action Event_OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
|
||||||
if(damage > 0.0 && damagetype & (DMG_BLAST|DMG_BURN|DMG_BLAST_SURFACE) == 0 && GetClientTeam(victim) == 2 && GetClientTeam(attacker) == 2 && attacker != victim) {
|
if(damage > 0.0 && damagetype & (DMG_BLAST|DMG_BURN|DMG_BLAST_SURFACE) == 0 && victim <= MaxClients && attacker <= MaxClients && attacker > 0 && victim > 0) {
|
||||||
|
if(GetClientTeam(victim) != 2 || GetClientTeam(attacker) != 2 || attacker == victim) return Plugin_Continue;
|
||||||
//Allow friendly firing BOTS that aren't idle players:
|
//Allow friendly firing BOTS that aren't idle players:
|
||||||
if(IsFakeClient(victim) && GetEntProp(attacker, Prop_Send, "m_humanSpectatorUserID") == 0) {
|
//if(IsFakeClient(victim) && !HasEntProp(attacker, Prop_Send, "m_humanSpectatorUserID") || GetEntProp(attacker, Prop_Send, "m_humanSpectatorUserID") == 0) return Plugin_Continue;
|
||||||
return Plugin_Continue;
|
|
||||||
}
|
|
||||||
int time = GetTime();
|
int time = GetTime();
|
||||||
if(time - lastFF[attacker] > hForgivenessTime.IntValue) {
|
if(time - lastFF[attacker] > hForgivenessTime.IntValue) {
|
||||||
playerTotalDamageFF[attacker] = 0.0;
|
playerTotalDamageFF[attacker] = 0.0;
|
||||||
|
@ -92,20 +92,21 @@ public Action Event_OnTakeDamage(int victim, int& attacker, int& inflictor, flo
|
||||||
playerTotalDamageFF[attacker] += damage;
|
playerTotalDamageFF[attacker] += damage;
|
||||||
lastFF[attacker] = time;
|
lastFF[attacker] = time;
|
||||||
if(GetUserAdmin(attacker) == INVALID_ADMIN_ID) {
|
if(GetUserAdmin(attacker) == INVALID_ADMIN_ID) {
|
||||||
if(playerTotalDamageFF[attacker] > hThreshold.IntValue) {
|
if(playerTotalDamageFF[attacker] > hThreshold.IntValue && !IsFinaleEnding) {
|
||||||
LogMessage("[NOTICE] Banning %N for excessive FF (%f HP) for %d minutes.", attacker, playerTotalDamageFF[attacker], hBanTime.IntValue);
|
LogMessage("[NOTICE] Banning %N for excessive FF (%f HP) for %d minutes.", attacker, playerTotalDamageFF[attacker], hBanTime.IntValue);
|
||||||
NotifyAllAdmins("[Notice] Banning %N for excessive FF (%f HP) for %d minutes.", attacker, playerTotalDamageFF[attacker], hBanTime.IntValue);
|
NotifyAllAdmins("[Notice] Banning %N for excessive FF (%f HP) for %d minutes.", attacker, playerTotalDamageFF[attacker], hBanTime.IntValue);
|
||||||
BanClient(attacker, hBanTime.IntValue, BANFLAG_AUTO | BANFLAG_AUTHID, "Excessive FF", "Excessive Friendly Fire", "TKStopper");
|
//BanClient(attacker, hBanTime.IntValue, BANFLAG_AUTO | BANFLAG_AUTHID, "Excessive FF", "Excessive Friendly Fire", "TKStopper");
|
||||||
|
//KickClient(attacker, "Excessive FF");
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}
|
}
|
||||||
|
//If the amount of MS is <= join time threshold * 60000 ms then cancel
|
||||||
if(IsFinaleEnding || GetTime() - iJoinTime[attacker] <= hJoinTime.IntValue / 60000) {
|
if(GetTime() - iJoinTime[attacker] <= hJoinTime.IntValue * 60000) {
|
||||||
return Plugin_Stop;
|
return Plugin_Stop;
|
||||||
}else{
|
}else {
|
||||||
SDKHooks_TakeDamage(attacker, attacker, attacker, damage / 3.0);
|
SDKHooks_TakeDamage(attacker, attacker, attacker, IsFinaleEnding ? damage * 2.0 : damage / 2.0);
|
||||||
damage /= 2.0;
|
damage = IsFinaleEnding ? 0.0 : damage / 2.0;
|
||||||
|
return Plugin_Changed;
|
||||||
}
|
}
|
||||||
return Plugin_Stop;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue