Thread: [Plugin] Anti Rush

Page 1 of 3 123 LastLast
Results 1 to 25 of 75
  1. #1
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    [Plugin] Anti Rush

    This doesn't work for all maps, but could be improved in the future. All the official campaigns (HLSP, Op4, BS) work with this plugin.

    The way it works is by searching for a game_end or trigger_changelevel entity and then replacing whatever triggers it with new ents for counting players. Once enough players have reached the level change or pressed the end-level button the map changes.

    You can configure the plugin with these cvars:
    Code:
    as_command rush.percent 51
    as_command rush.delay 5
    as_command rush.disabled 0
    as_command rush.mode 1
    rush.percent is the percentage of players needed to finish the map ("51" = 51%)
    rush.delay is the amount of time before changing maps after enough players have finished ("5" = 5 seconds. Minimum is 3.)
    rush.disabled disables anti-rush for the current map if set to "1" (can't be changed mid-map).
    rush.mode controls when to start the level change timer (rush.delay).
    • 0 = Timer starts when rush.percent of players finish. Instant change when 100% finish.
    • 1 (default) = Timer starts when first player finishes. Instant change when rush.percent of players finish.


    Players can say or type .rush in console to check how many more players are needed to finish the level.
    Attached Files Attached Files
    Last edited by w00tguy123; 08-08-2017 at 05:25 AM.
    Love,
    w00tguy

  2. #2
    warrior spy-warrior's Avatar  
    Contributor
    Join Date
    Nov 2006
    Location
    Europe, France, Paris
    Posts
    2,922

    Re: [Plugin] Anti Rush

    Thanks, good idea

    you have tested end map hl_c09 (20 players) ?
    the percentage of players needed to finish the map ("51" = 51%)

  3. #3
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    Yeah, hl_c09 works. The only map I remember doesn't work is hl_c12.
    Love,
    w00tguy

  4. #4
    Registered User tridz's Avatar
    Join Date
    Jan 2016
    Location
    Istanbul,Turkey
    Posts
    63

    Re: [Plugin] Anti Rush

    What if only 1 player is alive and he finishes the map. Will it also work?

  5. #5
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    If any players are dead or AFK they are still counted as not finished. Players in observer mode aren't counted though.

    Edit:
    It's easy to exclude dead players, but I don't think that would work well because lots of players could be killed by an explosion or something and then suddenly the level changes because one guy finished earlier and is still alive.

    Excluding AFK players might be worthwhile assuming you don't already use the AFK kicker plugin.
    Last edited by w00tguy123; 25-07-2016 at 01:01 PM.
    Love,
    w00tguy

  6. #6
    triggered Cadaver's Avatar
    Join Date
    Mar 2016
    Location
    Argentina
    Posts
    75

    Re: [Plugin] Anti Rush

    Really useful, thanks for this.



  7. #7
    warrior spy-warrior's Avatar  
    Contributor
    Join Date
    Nov 2006
    Location
    Europe, France, Paris
    Posts
    2,922

    Re: [Plugin] Anti Rush

    w00tguy123, you can tested script in server ? (add admin)

    [FR] Sven Co-op 5.0 Win, Half-Life

  8. #8
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    ^ I joined the server for a bit and it went well for a few maps. Then we hit a map where the level change trigger wouldn't enable despite it saying enough players finished and the trigger was enabled. Loading the map on my local server worked fine.

    Looks like this needs more testing before it can be used on public servers.
    Love,
    w00tguy

  9. #9
    warrior spy-warrior's Avatar  
    Contributor
    Join Date
    Nov 2006
    Location
    Europe, France, Paris
    Posts
    2,922

    Re: [Plugin] Anti Rush

    Ok, thanks to have tested.

    An old demand for anti rush.
    Une ancienne demande pour anti rush.


    http://forums.svencoop.com/showthread.php/43813-Request-make-a-player-go-into-observer-mode

  10. #10
    monster_robogrunt Zorbos's Avatar
    Join Date
    May 2015
    Location
    Hammer
    Posts
    114

    Re: [Plugin] Anti Rush

    This is amazing, thanks for doing this.

    Is there a cvar we can use to switch this behavior off for maps that don't need this? Or would setting the percentage to zero work in theory?

    A question about the delay. If I'm understanding it correctly, it only begins counting down once enough players have reached the trigger right? That's fantastic as it is, but could there be an additional option to just have the timer start as soon as one player enters, and then if the timer expires, the map changes on its own? If the percentage is met while the timer is going, the map just ends immediately. Synergy has a system in place like this and it works brilliantly in the HL2 coop campaign.

    For example, if there are 10 players connected, and rush.percent is set to 50, then 5 players need to be at the end. BUT.. if one person enters the trigger and 4 more somehow can't find their way there (or are AFK), then after a specified time (a minute or two is about appropriate, controllable by a cvar of course), the map would just change on it's own even though the original percentage wasn't met. And if those 4 DID get there, it just changes the map anyway like it's supposed to. I hope that explanation makes sense lol

    This could potentially solve the AFK issue some of the others were talking about in this thread and even potential trolling because if a player was the last one who needed to enter the trigger and they purposely decided not to enter it, or were AFK, it wouldn't matter because the time would run out.
    I suppose one could just set the percentage so that only one player is required and then set the delay to be a minute, but then wouldn't you have to wait an entire minute no matter how many additional people got to the end?

    Definitely gonna use this once you work out the kinks. Awesome stuff w00tguy!

  11. #11
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    I can add an option to start the timer when the first player finishes. spy-warrior, are you suggesting that players should go into observer mode when they reach the end?

    Unfortunately I couldn't reproduce the bug I saw on spy's server, so if anyone can figure out how to reproduce the bug reliably that would help out a lot. For some reason the trigger_changelevel in hl_c05_a1 was not set to SOLID_TRIGGER despite it saying so in chat. The only explanation I can think of is that the EHandle I saved got corrupted somehow, since it was apparently valid but did not point to the right entity anymore or something.

    Quote Originally Posted by Zorbos View Post
    Is there a cvar we can use to switch this behavior off for maps that don't need this? Or would setting the percentage to zero work in theory?
    Setting to zero should work if you do it per map, but you would still get the chat messages. I could add an option to turn it off for some maps. Would this work better as a cvar or a blacklist file?

    Quote Originally Posted by Zorbos View Post
    I suppose one could just set the percentage so that only one player is required and then set the delay to be a minute, but then wouldn't you have to wait an entire minute no matter how many additional people got to the end?
    The way it works now is the timer doesn't start until enough players have finished. If 100% of players finish, the timer is skipped and the level changes immediately, even if the timer has been running for some time.
    Last edited by w00tguy123; 27-07-2016 at 02:03 PM.
    Love,
    w00tguy

  12. #12
    monster_robogrunt Zorbos's Avatar
    Join Date
    May 2015
    Location
    Hammer
    Posts
    114

    Re: [Plugin] Anti Rush

    Quote Originally Posted by w00tguy123 View Post
    Setting to zero should work if you do it per map, but you would still get the chat messages. I could add an option to turn it off for some maps. Would this work better as a cvar or a blacklist file?
    I personally prefer cvars, but I'm fine with a blacklist too. Both are pretty easy to use imo
    Do whatever is easier / more effective for you!

  13. #13
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    Alright, the cvar is easier for me, I just didn't know what server owners preferred.

    Download v2 in the first post for the following new stuff:
    Code:
    - "rush.mode" and "rush.disabled" cvars added
    - possible fix for the changelevel bug I mentioned earlier
    - .rush command can be typed in console now.
    Love,
    w00tguy

  14. #14
    warrior spy-warrior's Avatar  
    Contributor
    Join Date
    Nov 2006
    Location
    Europe, France, Paris
    Posts
    2,922

    Re: [Plugin] Anti Rush

    Quote Originally Posted by w00tguy123 View Post
    spy-warrior, are you suggesting that players should go into observer mode when they reach the end?
    Yes, corrects small area (trigger_changelevel)

  15. #15
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    I have to admit I don't like the idea of waiting around in observer mode after finishing a map. As a player, I'd rather run around and guide the stragglers or something. Being removed from the game would feel like undeserved punishment.
    Love,
    w00tguy

  16. #16
    warrior spy-warrior's Avatar  
    Contributor
    Join Date
    Nov 2006
    Location
    Europe, France, Paris
    Posts
    2,922

    Re: [Plugin] Anti Rush

    trigger_changelevel
    The area is far too small to see over 6 players.
    Les zone sont bien trop petite pour voir plus de 6 joueurs.

  17. #17
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    Oh, yeah that's a good point. If finished players are set to non-solid then that should prevent them from blocking the end. Maybe they should also be made transparent so you know they've finished.
    Love,
    w00tguy

  18. #18
    monster_robogrunt Zorbos's Avatar
    Join Date
    May 2015
    Location
    Hammer
    Posts
    114

    Re: [Plugin] Anti Rush

    I just gave this a test run and it works great so far! I'll let you know if anything weird happens.

    I wanted to make a personal modification to the script so that it uses HUD_PRINTCENTER for the timer instead of the chatbox. Kind of like how Survival does when its initializing. That way you could actually see the numbers counting down too.
    I know it's this function that does it:

    Code:
    private void DisplayTimeUntilActivation()
    {
    	if( m_State != SURVIVAL_ACTIVATING )
    		return;
    			
    	const float flTimeLeft = m_flActivationTime - g_Engine.time;	
    		
    	const string szText = "Game will begin in " + int( Math.Ceil( flTimeLeft ) ) + " seconds";
    		
    	//PRINTTALK won't work here, probably because it's too soon after joining
    	g_PlayerFuncs.ClientPrintAll( HUD_PRINTCENTER, szText );
    			
    	g_Scheduler.SetTimeout( @this, "DisplayTimeUntilActivation", flTimeLeft < m_flDisplayTimeInterval ? flTimeLeft : m_flDisplayTimeInterval );
    }
    What would be the best way integrate this into the script without breaking it?

  19. #19
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    After line 143 you can make a call to a timer function that counts down from "delay". If you use SetTimeout or SetInverval then remember to remove or disable the timer on MapChange().

    I could add the HUD countdown though if you want.
    Love,
    w00tguy

  20. #20
    monster_robogrunt Zorbos's Avatar
    Join Date
    May 2015
    Location
    Hammer
    Posts
    114

    Re: [Plugin] Anti Rush

    Quote Originally Posted by w00tguy123 View Post
    After line 143 you can make a call to a timer function that counts down from "delay". If you use SetTimeout or SetInverval then remember to remove or disable the timer on MapChange().

    I could add the HUD countdown though if you want.
    Sure, that works too lol. I'm pretty bad when it comes to coding so I'd probably screw it up anyway. Thanks!

  21. #21
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    Uploaded v3:

    - Counter displayed in the middle of the screen for level change.
    - Players that finish are turned into ghosts so that they don't block others from finishing.
    Love,
    w00tguy

  22. #22
    monster_robogrunt Zorbos's Avatar
    Join Date
    May 2015
    Location
    Hammer
    Posts
    114

    Re: [Plugin] Anti Rush

    Still working really well, thanks for the support! Only one weird thing happened today. We had 4 players on, and with a percentage of 75%, should have required 3 to finish. However we got 3 to the end and nothing happened, so I assume it was actually waiting for a 4th player. It only happened for one map though and it wasn't an issue cause the timer ran out anyway.

    EDIT: A little update: it seems like sometimes (very randomly) the plugin ignores the setting I have for rush.disabled. I had it not work at all on a map that it normally works on. And when I typed .rush it said it was disabled due to cvar. Double checked the map cfgs, server cfg, and default map settings just to make sure I didn't accidentally disable it. It's strange. Doesn't happen all that often though it seems.
    Last edited by Zorbos; 29-07-2016 at 02:37 AM.

  23. #23
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    I have no idea what's going on with these random failures. My guess is some memory is getting corrupted by the game in some way, but I can't really debug that. I haven't been able to reproduce any of these bugs either. Maybe in a future version of SC I can rewrite this using a better method.
    Love,
    w00tguy

  24. #24
    warrior spy-warrior's Avatar  
    Contributor
    Join Date
    Nov 2006
    Location
    Europe, France, Paris
    Posts
    2,922

    Re: [Plugin] Anti Rush

    Quote Originally Posted by w00tguy123 View Post
    - Players that finish are turned into ghosts so that they don't block others from finishing.
    Good,
    please fix end + 4 players
    Thanks
    Last edited by spy-warrior; 30-07-2016 at 09:45 AM.

  25. #25
    func_vehicle enthusiaist w00tguy123's Avatar
    Join Date
    Dec 2006
    Location
    U.S. West
    Posts
    1,547

    Re: [Plugin] Anti Rush

    Quote Originally Posted by spy-warrior View Post
    please fix end + 4 players
    I don't understand. Something is wrong when 4 players reach the end?
    Love,
    w00tguy

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •