mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 21:23:21 +00:00
ftt: Record activator of marked ban
This commit is contained in:
parent
509e70b235
commit
cddecefa81
4 changed files with 11 additions and 14 deletions
|
@ -71,9 +71,8 @@ enum struct Troll {
|
|||
}
|
||||
if(this.flagNames == null) this.flagNames = new ArrayList(MAX_TROLL_FLAG_LENGTH);
|
||||
int index = this.flagNames.PushString(name);
|
||||
index = RoundFloat(Pow(2.0, float(index)));
|
||||
if(defaultOn)
|
||||
this.defaultFlags |= 1 << index;
|
||||
this.defaultFlags |= (1 << index);
|
||||
return index;
|
||||
}
|
||||
|
||||
|
@ -81,7 +80,6 @@ enum struct Troll {
|
|||
return this.flagNames != null && this.flagNames.Length > 0;
|
||||
}
|
||||
|
||||
|
||||
bool IsFlagActive(int client, trollFlag flag) {
|
||||
if(ActiveTrolls[client] > 0 && IsTrollActive(client, this.name) && this.activeFlagClients[client] >= 0) {
|
||||
return this.activeFlagClients[client] & view_as<int>(flag) != 0;
|
||||
|
@ -132,9 +130,8 @@ ArrayList categories;
|
|||
static int categoryID = -1;
|
||||
|
||||
void ResetClient(int victim, bool wipe = true) {
|
||||
if(wipe) {
|
||||
if(wipe) //TODO: Remove legacy system, including this:
|
||||
ActiveTrolls[victim] = 0;
|
||||
}
|
||||
SetEntityGravity(victim, 1.0);
|
||||
SetEntPropFloat(victim, Prop_Send, "m_flLaggedMovementValue", 1.0);
|
||||
SDKUnhook(victim, SDKHook_WeaponCanUse, Event_ItemPickup);
|
||||
|
@ -143,7 +140,6 @@ void ResetClient(int victim, bool wipe = true) {
|
|||
SDKUnhook(wpn, SDKHook_Reload, Event_WeaponReload);
|
||||
}
|
||||
|
||||
|
||||
int SetupTroll(const char[] name, const char description[128], int mods, bool flagsMultiselectable = false, int defaultFlags = 0) {
|
||||
if(mods == 0) {
|
||||
ThrowError("Troll \"%s\" has no flags defined.", name);
|
||||
|
@ -161,6 +157,7 @@ int SetupTroll(const char[] name, const char description[128], int mods, bool fl
|
|||
trollKV.SetValue(name, i);
|
||||
return i++;
|
||||
}
|
||||
|
||||
// Gets the Troll enum struct via name
|
||||
// Returns index of troll enum
|
||||
int GetTroll(const char[] name, Troll troll) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public void OnMapStart() {
|
|||
//CreateTimer(30.0, Timer_AutoPunishCheck, _, TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
public void OnClientPutInServer(int client) {
|
||||
g_PendingBanTroll[client] = false;
|
||||
g_PendingBanTroll[client] = 0;
|
||||
SDKHook(client, SDKHook_OnTakeDamage, Event_TakeDamage);
|
||||
}
|
||||
public void OnClientAuthorized(int client, const char[] auth) {
|
||||
|
@ -27,11 +27,11 @@ public void OnClientAuthorized(int client, const char[] auth) {
|
|||
}
|
||||
public void Event_PlayerDisconnect(Event event, const char[] name, bool dontBroadcast) {
|
||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||
if(g_PendingBanTroll[client]) {
|
||||
g_PendingBanTroll[client] = false;
|
||||
if(g_PendingBanTroll[client] > 0) {
|
||||
if(!IsFakeClient(client) && GetUserAdmin(client) == INVALID_ADMIN_ID) {
|
||||
BanIdentity(steamids[client], 0, BANFLAG_AUTHID, "TrollMarked", "ftt", 0);
|
||||
BanIdentity(steamids[client], 0, BANFLAG_AUTHID, "Marked as Troll", "ftt", GetClientOfUserId(g_PendingBanTroll[client]));
|
||||
}
|
||||
g_PendingBanTroll[client] = 0;
|
||||
}
|
||||
steamids[client][0] = '\0';
|
||||
ActiveTrolls[client] = 0;
|
||||
|
@ -352,7 +352,7 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
|||
public Action Event_TakeDamage(int victim, int& attacker, int& inflictor, float& damage, int& damagetype) {
|
||||
//Stop FF from marked:
|
||||
if(attacker > 0 && attacker <= MaxClients && IsClientInGame(attacker) && IsPlayerAlive(attacker)) {
|
||||
if(g_PendingBanTroll[attacker] && GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) {
|
||||
if(g_PendingBanTroll[attacker] > 0 && GetClientTeam(attacker) == 2 && GetClientTeam(victim) == 2) {
|
||||
|
||||
return Plugin_Stop;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ void SetWitchTarget(int witch, int target) {
|
|||
}
|
||||
|
||||
bool ToggleMarkPlayer(int client, int target) {
|
||||
if(g_PendingBanTroll[target]) {
|
||||
g_PendingBanTroll[target] = false;
|
||||
if(g_PendingBanTroll[target] > 0) {
|
||||
g_PendingBanTroll[target] = 0;
|
||||
LogAction(client, target, "\"%L\" unmarked \"%L\" as troll", client, target);
|
||||
ShowActivityEx(client, "[FTT] ", "unmarked %N as troll", target);
|
||||
return true;
|
||||
|
@ -41,7 +41,7 @@ bool ToggleMarkPlayer(int client, int target) {
|
|||
Call_PushCell(client);
|
||||
Call_PushCell(target);
|
||||
Call_Finish();
|
||||
g_PendingBanTroll[target] = true;
|
||||
g_PendingBanTroll[target] = GetClientUserId(client);
|
||||
EnableTroll(target, "No Profanity");
|
||||
LogAction(client, target, "\"%L\" marked \"%L\" as troll", client, target);
|
||||
ShowActivityEx(client, "[FTT] ", "marked %N as troll", target);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue