mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 07:33:22 +00:00
Add frequency increaser for antirush
This commit is contained in:
parent
f60250042a
commit
33c8be2317
3 changed files with 27 additions and 5 deletions
|
@ -27,6 +27,7 @@ public void OnMapStart() {
|
|||
public void OnClientPutInServer(int client) {
|
||||
pdata[client].pendingTrollBan = 0;
|
||||
pdata[client].shootAtTarget = 0;
|
||||
fAntiRushFrequencyCounter[client] = 0.0;
|
||||
if(IsTrollActive(client, "Voice Mute"))
|
||||
BaseComm_SetClientMute(client, true);
|
||||
SDKHook(client, SDKHook_OnTakeDamage, Event_TakeDamage);
|
||||
|
@ -907,12 +908,15 @@ public bool TraceEntityFilterPlayer(int entity, int mask, any data) {
|
|||
return data != entity && entity <= MaxClients && GetClientTeam(entity) == 2 && IsPlayerAlive(entity);
|
||||
}
|
||||
|
||||
float iLastAntiRushEvent[MAXPLAYERS+1];
|
||||
// TODO: Increase the frequency of spawns the longer they are in antirush. Possibly increase int and decrease over time
|
||||
public Action OnAntiRush(int client, int &type, float distance) {
|
||||
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();
|
||||
if(GetGameTime() - fLastAntiRushEvent[client] > ANTI_RUSH_DEFAULT_FREQUENCY - fAntiRushFrequencyCounter[client]) { <
|
||||
if(fAntiRushFrequencyCounter[client] < ANTI_RUSH_DEFAULT_FREQUENCY) {
|
||||
fAntiRushFrequencyCounter[client] += ANTI_RUSH_FREQ_INC;
|
||||
}
|
||||
SpecialType special = view_as<SpecialType>(GetRandomInt(1,6));
|
||||
fLastAntiRushEvent[client] = GetGameTime();
|
||||
SpawnSpecialForTarget(special, client);
|
||||
PrintToConsoleAll("[FTT] Spawning anti-rush special on %N (dist=%f) (special=%s)", client, distance, SPECIAL_NAMES[view_as<int>(special)-1]);
|
||||
}
|
||||
|
@ -920,6 +924,17 @@ public Action OnAntiRush(int client, int &type, float distance) {
|
|||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
Action Timer_DecreaseAntiRush(Handle h) {
|
||||
for(int i = 1; i <= MaxClients; i++) {
|
||||
if(fAntiRushFrequencyCounter[i] > 1.0) {
|
||||
fAntiRushFrequencyCounter[i]--;
|
||||
} else {
|
||||
fAntiRushFrequencyCounter = 0.0;
|
||||
}
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void L4D2_CInsectSwarm_CanHarm_Post(int acid, int spitter, int entity) {
|
||||
if(entity <= MaxClients)
|
||||
pdata[entity].lastInSpitTime = GetGameTime();
|
||||
|
@ -964,4 +979,4 @@ void Event_HealSuccess(Event event, const char[] name, bool dontBroadcast) {
|
|||
if(client > 0 && userid == healTargetPlayer) {
|
||||
StopHealingBots();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,6 +93,9 @@ Handle stopHealingTimer;
|
|||
|
||||
float entLastHeight[2048];
|
||||
|
||||
float fLastAntiRushEvent[MAXPLAYERS+1];
|
||||
float fAntiRushFrequencyCounter[MAXPLAYERS+1];
|
||||
|
||||
|
||||
#define MODEL_CAR "models/props_vehicles/cara_95sedan.mdl"
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#define MAIN_TIMER_INTERVAL_S 5.0
|
||||
#define PLUGIN_VERSION "1.0"
|
||||
#define ANTI_RUSH_DEFAULT_FREQUENCY 30.0
|
||||
#define ANTI_RUSH_FREQ_INC 0.5
|
||||
|
||||
#include <sourcemod>
|
||||
#include <sdktools>
|
||||
|
@ -44,6 +46,8 @@ public void OnPluginStart() {
|
|||
SetupTrolls();
|
||||
SetupsTrollCombos();
|
||||
|
||||
CreateTimer(1.0, Timer_DecreaseAntiRush, TIMER_REPEAT);
|
||||
|
||||
g_spSpawnQueue = new ArrayList(sizeof(SpecialSpawnRequest));
|
||||
|
||||
// Witch target overwrite stuff:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue