mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-10 01:03:21 +00:00
FFKickProtection: Fix implementation
This commit is contained in:
parent
35d2b85dee
commit
46c0f71c19
2 changed files with 9 additions and 16 deletions
Binary file not shown.
|
@ -33,9 +33,7 @@ public void OnPluginStart() {
|
||||||
HookUserMessage(GetUserMessageId("VotePass"), VotePassFail);
|
HookUserMessage(GetUserMessageId("VotePass"), VotePassFail);
|
||||||
HookUserMessage(GetUserMessageId("VoteFail"), VotePassFail);
|
HookUserMessage(GetUserMessageId("VoteFail"), VotePassFail);
|
||||||
|
|
||||||
forceKickFFThreshold = CreateConVar("sm_votekick_force_threshold","20.0","The threshold of amount of FF to then automatically kick.\n0: Any attempted damage\n -1: No auto kick.\n>0: When FF count > this", FCVAR_NONE, true, -1.0);
|
forceKickFFThreshold = CreateConVar("sm_votekick_force_threshold","30.0","The threshold of amount of FF to then automatically kick.\n0: Any attempted damage\n -1: No auto kick.\n>0: When FF count > this", FCVAR_NONE, true, -1.0);
|
||||||
|
|
||||||
//HookEvent("vote_started",Event_VoteStarted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientPutInServer(int client) {
|
public void OnClientPutInServer(int client) {
|
||||||
|
@ -74,15 +72,16 @@ public Action VoteStart(int client, const char[] command, int argc) {
|
||||||
int target = GetClientOfUserId(StringToInt(option));
|
int target = GetClientOfUserId(StringToInt(option));
|
||||||
AdminId callerAdmin = GetUserAdmin(client);
|
AdminId callerAdmin = GetUserAdmin(client);
|
||||||
AdminId targetAdmin = GetUserAdmin(target);
|
AdminId targetAdmin = GetUserAdmin(target);
|
||||||
if (targetAdmin != INVALID_ADMIN_ID && callerAdmin != INVALID_ADMIN_ID && GetAdminImmunityLevel(targetAdmin) >= GetAdminImmunityLevel(callerAdmin)) {
|
if(callerAdmin != INVALID_ADMIN_ID && targetAdmin == INVALID_ADMIN_ID || GetAdminImmunityLevel(targetAdmin) < GetAdminImmunityLevel(callerAdmin)) {
|
||||||
PrintToChat(target, "%N attempted to vote kick you!", client);
|
PrintToChat(target, "%N has attempted to vote kick you.", client);
|
||||||
|
//possibly plugin_stop
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
if(GetClientTeam(target)== 2) {
|
if(GetClientTeam(target) == 2) {
|
||||||
disableFFClient = target;
|
disableFFClient = target;
|
||||||
ffDamageCount = 0;
|
ffDamageCount = 0;
|
||||||
}
|
}
|
||||||
PrintToServer("KICK VOTE STARTED | Target=%N | Caller=%N", issue, target, client);
|
PrintToServer("VOTE KICK STARTED | Target=%N | Caller=%N", issue, target, client);
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
//Kick vote started
|
//Kick vote started
|
||||||
|
@ -97,20 +96,14 @@ public Action VotePassFail(UserMsg msg_id, BfRead msg, const int[] players, int
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
|
public Action OnTakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype, int& weapon, float damageForce[3], float damagePosition[3]) {
|
||||||
if(disableFFClient == attacker) {
|
if(disableFFClient == attacker && damage > 0.0 && victim > 0 && victim <= MaxClients && GetClientTeam(victim) == 2) {
|
||||||
if(damage > 0.0) {
|
|
||||||
ffDamageCount++;
|
|
||||||
}
|
|
||||||
if(forceKickFFThreshold.IntValue > -1 && ffDamageCount > 0.0) {
|
if(forceKickFFThreshold.IntValue > -1 && ffDamageCount > 0.0) {
|
||||||
//auto kick
|
//auto kick
|
||||||
if(forceKickFFThreshold.FloatValue == 0.0) {
|
if(ffDamageCount > forceKickFFThreshold.FloatValue) {
|
||||||
KickClient(disableFFClient, "Kicked for excessive friendly fire");
|
|
||||||
}else if(ffDamageCount > forceKickFFThreshold.FloatValue) {
|
|
||||||
KickClient(disableFFClient, "Kicked for excessive friendly fire");
|
KickClient(disableFFClient, "Kicked for excessive friendly fire");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
damage = 0.0;
|
return Plugin_Stop;
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
}
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue