View Single Post
Author Message
RedSword
SourceMod Plugin Approver
Join Date: Mar 2006
Location: Quebec, Canada
Old 03-07-2011 , 13:10   [CS:S+GO] Afk Bomb
Reply With Quote #1

Afk Bomb

v. 1.5.0

Features :
  • Prevent short-afking from breaking a full round's gameplay :
  • Give the bomb to a random teamate if the bomber is afk at the beginning of the round. (or drop it)
  • Drop the bomb if the bomber is afk and make bomber teamsay that he's dropping the bomb. (or give to a teamate)

How it works :
  • For the first check of the round :
  • Check the "state" of the bomber at round start (1.0 sec after it to be exact).
  • Check for a new delayed "state" after a certain amount of time to see if it is the same.
  • If over a certain amount of time the "state" of the player didn't change, then he is considered afk : the bomb is dropped/given to a teamate (depending on afkbomb_action) and a message is displayed.
  • For the other checks :
  • After the first check, the same process is repeated, but it uses the convar "afkbomb_lateCheckDelay" for the delay between two checks.
  • When the total number of checks where the player didn't change his state equals the value of the convar "afkbomb_lateCheck", then the bomb is dropped/given to a teamate (depending on afkbomb_latecheckaction).

Known bugs/exploits :
  • The bomber can drop his bomb in an unfinite loop (rare; depends on spawn location; if it happens someone can stick him where he throws the bomb to get it, so it isn't a real problem). Since 1.3.1 this is way less frequent (throw is harder).
  • -------The following are since 1.4.0 and updated since 1.5.0-------
  • The random person can be AFK (ONLY if no players are moving since 1.5.0).
  • A player could exploit "afkbomb_latecheckaction 0" feature by fake-afking and therefore send the bomb to a random teamate elsewhere on the map. (in 1.5.0, I did split afkbomb_action into the same CVar and afkbomb_latecheckaction )

CVars :
  • afkbombversion: Gives version -_-'
  • -------------------------
  • afkbomb : How long, in seconds, before the delayed "state" check. 0 = plugin disabled. 1+ = enabled. Default 2.
  • afkbomb_freezetime : If "mp_freezetime" value is added to the timer that will run the delayed "state" first check. Default 0 (disabled).
  • -------------------------
  • afkbomb_msg : Notify team when bomb is dropped (afkbomb_action=1) / Notify everyone when bomb is given to a random terrorist (afkbomb_action=0 ). 0 = no, 1 = yes. Default 1.
  • -------------------------
  • afkbomb_latecheck : Number of latechecks to do before dropping the bomb. 0 = disable latechecks. Default 2.
  • afkbomb_latecheckdelay : Time between 2 latechecks to drop the bomb, in seconds. Min. 1.0, Default 5.0.
  • --------since 1.4.0--------
  • afkbomb_action : What to do when someone is considered afk at the beginning of the round. 1=Drop. 0=Give to random player. Default 0.
  • --------since 1.5.0--------
  • afkbomb_latecheckaction : What to do when someone is considered afk after the beginning of the round. 1=Drop. 0=Give to random player (not recommended since it could be exploited). Default 1. (This is afkbomb_action for latechecks)

Notes :
  • Place "afkbomb.phrases.txt" in "translations" folder.
  • To manually bomb drop and other useful bomb related commands, use Bomb Commands (has menu and a tell-me-who-threw-the-bomb-in-an-unreachable-spot thing).

--------------

Any suggestions/comments on the code or the plugin are welcomed and appreciated.

Credits to :
  • dalto : for his drop bomb code (http://forums.alliedmods.net/showthread.php?p=523188)
  • AltPluzF4 : for his sig-scanning thread that made me correct dalto's drop bomb code (SDK Call with invalid parameters; http://forums.alliedmods.net/archive...p/t-78309.html)
  • AtomicStryker : For having in the past the same problem as me (wrong function signature usage via SDKCall() ) and posting for help. (http://forums.alliedmods.net/showthread.php?t=121145)
  • Dr!fter : for the second sig-function, so it can now work correctly with CSS : DM (no invalid handle). Also for his use of the SDKCall (in [CSS] Weapon Restrict plugin) with the 4th & 5th argument different than me, making the bomb drop further.
  • sinblaster : for testing & bugreporting.
  • psychonic : for reporting a memory leak and approving.
  • TnTSCS : for bringing me (07-11-2011) signature for drop-weapon function.
  • Translators :
    Spoiler

Changelog :
Spoiler


Todo list :
  • Nothing at the moment. You're free to suggest things (doesn't mean I'll accept).
Attached Files
File Type: sp Get Plugin or Get Source (afkbomb.sp - 6534 views - 12.7 KB)
File Type: txt afkbomb.phrases.txt (1.7 KB, 2911 views)
__________________
My plugins :
Red Maze
Afk Bomb
RAWR (per player/rounds Awp Restrict.)
Kill Assist
Be Medic

You can also Donate if you appreciate my work

Last edited by RedSword; 09-26-2013 at 13:03. Reason: sk+cze; 709dl+1355trl
RedSword is offline