From e0ae644c8062f210387aade8836ba210175f97d8 Mon Sep 17 00:00:00 2001 From: Jackz Date: Wed, 19 May 2021 14:52:42 -0500 Subject: [PATCH] ftt: Integrate swarm directly --- README.md | 2 +- scripting/include/ftt.inc | 4 ++-- scripting/l4d2_feedthetrolls.sp | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7d4121f..73d744e 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ Troll Modes: (updated 4/20/2021) 11. **ThrowItAll** - Makes a player throw all their items at any nearby players. Runs on the interval set by sm_ftt_throw_interval. 12. **GunJam** - On reload, small chance their gun gets jammed - Can't reload. 13. **NoPickup** - Prevents a player from picking up ANY (new) item. Use ThrowItAll to make them drop -14. **Swarm** - Swarms a player with zombies. Requires my [swarm plugin](#l4d2_swarm) +14. **Swarm** - Swarms a player with zombies. 15. **Honk** – Replaces player's chat messages with honk 16. **Special Magnet** – Attracts ALL specials to the closest alive trolled target with this troll enabled 17. **Tank Magnet** – Attracts ALL tanks to the closest alive trolled target with this troll enabled diff --git a/scripting/include/ftt.inc b/scripting/include/ftt.inc index c9d737b..65db12b 100644 --- a/scripting/include/ftt.inc +++ b/scripting/include/ftt.inc @@ -215,9 +215,9 @@ void ApplyModeToClient(int client, int victim, trollMode mode, TrollModifier mod } case Troll_Swarm: { if(modifier == TrollMod_InstantFire) { - FakeClientCommandEx(client, "sm_swarm #%d", victim); + L4D2_RunScript("RushVictim(GetPlayerFromUserID(%d), %d)", victim, 15000); }else if(modifier == TrollMod_Repeat) { - FakeClientCommandEx(client, "sm_swarmtoggle #%d", victim); + }else{ ReplyToCommand(client, "Invalid modifier for mode."); return; diff --git a/scripting/l4d2_feedthetrolls.sp b/scripting/l4d2_feedthetrolls.sp index e9f4cef..4c9a351 100644 --- a/scripting/l4d2_feedthetrolls.sp +++ b/scripting/l4d2_feedthetrolls.sp @@ -136,10 +136,11 @@ public void Event_PanicEventCreate(Event event, const char[] name, bool dontBroa } } public void Event_CarAlarm(Event event, const char[] name, bool dontBroadcast) { - int client = GetClientOfUserId(event.GetInt("userid")); + int user = event.GetInt("userid"); + int client = GetClientOfUserId(user; if(client) { PrintToChatAll("%N has alerted the horde!", client); - FakeClientCommandEx(client, "sm_swarm #%d", client); + L4D2_RunScript("RushVictim(GetPlayerFromUserID(%d), %d)", user, 15000); } //Ignore car alarms for autopunish lastButtonUser = -1; @@ -704,6 +705,8 @@ public Action Timer_Main(Handle timer) { SetEntPropFloat(i, Prop_Send, "m_healthBufferTime", bufferTime - 7.0); } } + }else if(HasTrollMode(i, Troll_Swarm)) { + L4D2_RunScript("RushVictim(GetPlayerFromUserID(%d), %d)", GetClientUserId(i), 15000); } } }