mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 20:13:21 +00:00
updates
This commit is contained in:
parent
a1b239f394
commit
6c0e7bc1f2
23 changed files with 726 additions and 108 deletions
|
@ -318,6 +318,7 @@ void ApplyTroll(int victim, const char[] name, int activator, trollModifier modi
|
|||
static Troll troll;
|
||||
int trollIndex = GetTroll(name, troll);
|
||||
if(trollIndex == -1) {
|
||||
ReplyToCommand(activator, "Unknown troll \"%s\"", name);
|
||||
PrintToServer("[FTT] %N attempted to apply unknown troll: %s", activator, name);
|
||||
return;
|
||||
}
|
||||
|
@ -349,17 +350,23 @@ void ApplyTroll(int victim, const char[] name, int activator, trollModifier modi
|
|||
}
|
||||
}
|
||||
|
||||
bool isActive = IsTrollActive(victim, troll.name);
|
||||
|
||||
// Toggle on flags for client, if it's not a single run.
|
||||
if(modifier & TrollMod_Constant) {
|
||||
Trolls[troll.id].activeFlagClients[victim] = isActive ? -1 : flags;
|
||||
}
|
||||
|
||||
// Applies any custom logic needed for a troll, mostly only used for TrollMod_Instant
|
||||
if(!ApplyAffect(victim, troll, activator, modifier, flags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Log all actions, indicating if constant or single-fire, and if any flags
|
||||
bool isActive = IsTrollActive(victim, troll.name);
|
||||
if(!silent) {
|
||||
if(isActive) {
|
||||
ShowActivityEx(activator, "[FTT] ", "deactivated \"%s\" on %N. ", troll.name, victim);
|
||||
LogAction(activator, victim, "\"%L\" deactivated \"%s\" on \"%L\"", activator, troll.name, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "deactivated {green}\"%s\"{default} on %N. ", troll.name, victim);
|
||||
LogAction(activator, victim, "\"%L\" deactivated {green}\"%s\"{default} on \"%L\"", activator, troll.name, victim);
|
||||
} else {
|
||||
static char flagName[MAX_TROLL_FLAG_LENGTH];
|
||||
flagName[0] = '\0';
|
||||
|
@ -380,29 +387,25 @@ void ApplyTroll(int victim, const char[] name, int activator, trollModifier modi
|
|||
if(modifier & TrollMod_Constant) {
|
||||
if(flags > 0) {
|
||||
if(flagName[0] != '\0') {
|
||||
ShowActivityEx(activator, "[FTT] ", "activated constant \"%s\" (%s) for %N. ", troll.name, flagName, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "activated constant {green}\"%s\"{default} ({yellow}%s{default}) for %N. ", troll.name, flagName, victim);
|
||||
} else {
|
||||
ShowActivityEx(activator, "[FTT] ", "activated constant \"%s\" (%d) for %N. ", troll.name, flags, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "activated constant {green}\"%s\"{default} ({yellow}%d{default}) for %N. ", troll.name, flags, victim);
|
||||
}
|
||||
} else
|
||||
ShowActivityEx(activator, "[FTT] ", "activated constant \"%s\" for %N. ", troll.name, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "activated constant {green}\"%s\"{default} for %N. ", troll.name, victim);
|
||||
} else if(flags > 0) {
|
||||
if(flagName[0] != '\0') {
|
||||
ShowActivityEx(activator, "[FTT] ", "activated \"%s\" (%s) for %N. ", troll.name, flagName, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "activated {green}\"%s\"{default} ({yellow}%s{default}) for %N. ", troll.name, flagName, victim);
|
||||
} else {
|
||||
ShowActivityEx(activator, "[FTT] ", "activated \"%s\" (%d) for %N. ", troll.name, flags, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "activated {green}\"%s\"{default} ({yellow}%d{default}) for %N. ", troll.name, flags, victim);
|
||||
}
|
||||
} else
|
||||
ShowActivityEx(activator, "[FTT] ", "activated \"%s\" for %N. ", troll.name, victim);
|
||||
CShowActivityEx(activator, "[FTT] ", "activated {green}\"%s\"{default} for %N. ", troll.name, victim);
|
||||
|
||||
LogAction(activator, victim, "\"%L\" activated \"%s\" (%d) for \"%L\"", activator, troll.name, flags, victim);
|
||||
LogAction(activator, victim, "\"%L\" activated {green}\"%s\"{default} ({yellow}%d{default}) for \"%L\"", activator, troll.name, flags, victim);
|
||||
}
|
||||
} else {
|
||||
ReplyToCommand(activator, "ftt: Applied \"%s\" on %N with flags=%d", troll.name, victim, flags);
|
||||
}
|
||||
// Toggle on flags for client, if it's not a single run.
|
||||
if(modifier & TrollMod_Constant) {
|
||||
Trolls[troll.id].activeFlagClients[victim] = isActive ? -1 : flags;
|
||||
CReplyToCommand(activator, "ftt: Applied {green}\"%s\"{default} on %N with flags=%d", troll.name, victim, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -572,4 +572,44 @@ public Action Command_Stagger(int client, int args) {
|
|||
ReplyToCommand(client, "syntax: sm_stagger <target player>");
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_SmartCharge(int client, int args) {
|
||||
if(args > 0) {
|
||||
static char arg1[32], arg2[8];
|
||||
GetCmdArg(1, arg1, sizeof(arg1));
|
||||
GetCmdArg(2, arg2, sizeof(arg2));
|
||||
int timeout = StringToInt(arg2);
|
||||
if(timeout == 0) timeout = 15;
|
||||
|
||||
int target_list[1], target_count;
|
||||
static char target_name[MAX_TARGET_LENGTH];
|
||||
bool tn_is_ml;
|
||||
if ((target_count = ProcessTargetString(
|
||||
arg1,
|
||||
client,
|
||||
target_list,
|
||||
1,
|
||||
COMMAND_FILTER_ALIVE | COMMAND_FILTER_NO_MULTI,
|
||||
target_name,
|
||||
sizeof(target_name),
|
||||
tn_is_ml)) <= 0
|
||||
) {
|
||||
/* This function replies to the admin with a failure message */
|
||||
ReplyToTargetError(client, target_count);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
if(g_iSmartChargeActivator[target_list[0]]) {
|
||||
ReplyToCommand(client, "Target already has auto smart charge enabled");
|
||||
} else {
|
||||
g_iSmartChargeAttempts[target_list[0]] = 0;
|
||||
g_iSmartChargeMaxAttempts[target_list[0]] = timeout;
|
||||
g_iSmartChargeActivator[target_list[0]] = GetClientUserId(client);
|
||||
CreateTimer(1.0, Timer_CheckForChargerOpportunity, GetClientUserId(target_list[0]), TIMER_REPEAT | TIMER_FLAG_NO_MAPCHANGE);
|
||||
ShowActivity(client, "Enabling smart auto-charge on %N for %d seconds", target_list[0], timeout);
|
||||
}
|
||||
} else {
|
||||
ReplyToCommand(client, "syntax: sm_smartcharge <target player> [timeout or default 10s]");
|
||||
}
|
||||
return Plugin_Handled;
|
||||
}
|
|
@ -179,7 +179,7 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
|
|||
if(existingTarget > 0) {
|
||||
if(IsPlayerAlive(existingTarget)) {
|
||||
// Insta-specials ALWAYS target, if target has any attackers remaining
|
||||
if(g_iSpecialAttackFlags[attacker] & SPI_AlwaysTarget) {
|
||||
if(g_iSpecialAttackFlags[attacker] & view_as<int>(SPI_AlwaysTarget)) {
|
||||
curTarget = existingTarget;
|
||||
return Plugin_Changed;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public Action L4D2_OnChooseVictim(int attacker, int &curTarget) {
|
|||
}
|
||||
// If found, set, else just let game decide
|
||||
if(closestClient > 0) {
|
||||
PrintToConsoleAll("[FTT/Debug] infected %N -> attack -> %N", attacker, closetClient);
|
||||
PrintToConsoleAll("[FTT/Debug] infected %N -> attack -> %N", attacker, closestClient);
|
||||
g_iAttackerTarget[attacker] = GetClientUserId(closestClient);
|
||||
curTarget = closestClient;
|
||||
return Plugin_Changed;
|
||||
|
@ -529,7 +529,7 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
|||
if(GetClientAimTarget(client, true) == shootAtTarget[client]) {
|
||||
if(!IsActorBusy(client))
|
||||
PerformScene(client, "PlayerLaugh");
|
||||
buttons |= IN_ATTACK;
|
||||
buttons |= IN_ATTACK &~ (IN_RELOAD);
|
||||
return Plugin_Changed;
|
||||
} else {
|
||||
if(!IsClientConnected(shootAtTarget[client])) {
|
||||
|
@ -541,8 +541,6 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
|||
}
|
||||
|
||||
// Inverted control code:
|
||||
static int invertedTrollIndex;
|
||||
if(invertedTrollIndex == 0) invertedTrollIndex = GetTrollID("Inverted Controls");
|
||||
if(Trolls[invertedTrollIndex].IsActive(client)) {
|
||||
if(buttons & IN_MOVELEFT || buttons & IN_MOVERIGHT) {
|
||||
vel[1] = -vel[1];
|
||||
|
@ -795,7 +793,7 @@ public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
|
|||
|
||||
float iLastAntiRushEvent[MAXPLAYERS+1];
|
||||
public Action OnAntiRush(int client, int &type, float distance) {
|
||||
if(client && client <= MaxClients && type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) {
|
||||
if(client && client > 0 && client <= MaxClients && type == 3 && IsPlayerAlive(client) && !IsPlayerIncapped(client)) {
|
||||
if(GetGameTime() - iLastAntiRushEvent[client] > 30.0) {
|
||||
SpecialType special = view_as<SpecialType>(GetRandomInt(1,6));
|
||||
iLastAntiRushEvent[client] = GetGameTime();
|
||||
|
@ -825,13 +823,17 @@ public void Event_EnteredSpit(Event event, const char[] name, bool dontBroadcast
|
|||
}
|
||||
|
||||
public void Event_BotPlayerSwap(Event event, const char[] name, bool dontBroadcast) {
|
||||
//Player replaced a bot
|
||||
//Player replaced their idle bot
|
||||
int client = GetClientOfUserId(event.GetInt("player"));
|
||||
if(client) {
|
||||
bool debug_hadTroll = false;
|
||||
for(int i = 1; i <= MAX_TROLLS; i++) {
|
||||
if(Trolls[i].IsActive(client) && Trolls[i].HasMod(TrollMod_Constant)) { //Add activeFlagClients >= 0 check possibly?
|
||||
ApplyAffect(client, Trolls[i], -1, TrollMod_Constant, Trolls[i].activeFlagClients[client]);
|
||||
debug_hadTroll = true;
|
||||
}
|
||||
}
|
||||
if(debug_hadTroll)
|
||||
PrintToServer("[FTT] Re-applied trolls for was-idle player %N", client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ stock bool SpawnSpecialForTarget(SpecialType specialType, int target, SpecialSpa
|
|||
}
|
||||
|
||||
// Target is optional
|
||||
stock bool SpawnSpecialAtPosition(SpecialType special, const float destination[3], const float angle[3], int target = 0, int flags) {
|
||||
stock bool SpawnSpecialAtPosition(SpecialType special, const float destination[3], const float angle[3], int target = 0, int flags = 0) {
|
||||
SpecialSpawnRequest request;
|
||||
request.type = special;
|
||||
if(target)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue