AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] No Double Push (2.4.6, 2015-12-05) (https://forums.alliedmods.net/showthread.php?t=132651)

Chanz 07-17-2010 11:33

[ANY] No Double Push (2.4.6, 2015-12-05)
 
10 Attachment(s)
Code:

/*
* No Double Push - Locks buttons.
*
*
* Description:
* Locks func_button and func_rot_button entities for a certain amount of time, to prevent double pushing on deathrun or other maps.
*
*
* Installation:
* Place the 'nodoublepush.smx' into your "<moddir>/addons/sourcemod/plugins" folder.
* Place the 'plugin.nodoublepush.cfg' into your "<moddir>/cfg/sourcemod/" folder.
*
*
* Configuration:
* sm_nodoublepush_enable - Enable or disable No Double Push.
* sm_nodoublepush_time - The time in seconds, when the button should be unlocked again. -1 will never unlock the buttons again.
* sm_nodoublepush_deathrun - How to handle deathrun maps: 0 this plugin is always on, 1 this plugin is only on deathrun maps on, 2 this plugin is only on deathrun maps off.
* sm_nodoublepush_triggertime - Only change the time of buttons if the original time (in seconds) is greater than this value (in seconds).
* sm_nodoublepush_enablecolor - If this is set to 1 every button turns red when locked. By setting this to 0 the buttrons never change color.
*
*
* Changelog:
* 05.12.2015 - v2.4.6 - Added cvar to disable colors
*
* 15.08.2010 - v2.4.5 if you use this in CSS it's recommanded that you update to this version!
* Rewrite of the hole code to prevent double push.
* Changed: Instead of deleting or chaning the buttons return time, this plugin now locks all buttons for a certain time.
* Added: Func_butttons are now red if they are locked.
* Added: On plugin unload all buttons return to their normal behavior.
*
* 19.07.2010 - v1.2.0
* Fixed in CSS that round_start event is setting back the old values from the map.
*
* v1.1.0
* Added sm_nodoublepush_triggertime to prevent no trap buttons are only once pushable.
*
* v1.0.0
* Public release.
*
*
* Thank you Berni and SourceMod/AlliedModders-Team
* Thank you thetwistedpanda for letting me know about that the buttons won't keep their assigned time.
*/

Download:

thetwistedpanda 07-18-2010 19:50

Re: No Double Push - Set return time (wait) of buttons (works for any game)
 
As I mentioned in another topic, that method doesn't exactly work. Printing the logs to chat will show that the entity has accepted your dispatched value, but buttons continue to function normally and a stripper_dump will show that the entities retain their true wait value. If you try it on a map that has a low recovery time, such as dr_manylevelsofhell_fix4 (20 seconds), you'll see that buttons recover normally.

Chanz 07-18-2010 20:02

Re: No Double Push - Set return time (wait) of buttons (works for any game)
 
Could it be because of a round restart or do the buttons reset in the same round?
Its strange that this won't work with buttons, I've using the same code for a long time now in hl2dm to let func_doors stay open when used once.

Do you know, when the buttons retain their true value? When pressed or on just the next frame?

thetwistedpanda 07-18-2010 20:07

Re: No Double Push - Set return time (wait) of buttons (works for any game)
 
It's quite possible they're being reset on round restart, I never thought of that, and I've never ran a stripper dump before that period. All I know is I fiddled with the code for weeks with every combination of ints/strings/floats possible and buttons refused keep the values that were dispatched to them. I'll try to test it on my server and get back to you, not sure when that'll be.

thetwistedpanda 07-18-2010 20:43

Re: No Double Push - Set return time (wait) of buttons (works for any game)
 
Update: I tested the code on both steamworks and sunnyday, and the buttons are definitely being reset after the values are being assigned. However, I'm not sure if it's after round_start or if it's being done every game frame. A stripper dump shows that the values have already been reset after a round has been started, so I'm inclined to believe it's being done per frame. Using Stripper: Source, however, I'm able to set all wait values to "-1" when the map loads and those values remain. So perhaps we should look for a function that fires prior to OnMapStart?

According to dirka_dirka, round_start and round_start_post_nav fire once prior to OnMapStart.

Chanz 07-18-2010 20:49

Re: No Double Push - Set return time (wait) of buttons (works for any game)
 
Code:

Changed button (463) wait time from -333.000000 to -1.000000
Changed button (464) wait time from -333.000000 to -1.000000
Changed button (474) wait time from -333.000000 to -1.000000
######round restart#######
Changed button (202) wait time from -1.000000 to 15.000000
Changed button (212) wait time from -1.000000 to 15.000000
Changed button (287) wait time from -1.000000 to 30.000000

Some examples -333.0 is init value of an array.
It was indeed the round_start that changed some buttons back to their normal values.
I'll add the changes and reupload the plugin in some minutes.

edit: updated to 1.2.0

thetwistedpanda 07-18-2010 21:48

Re: No Double Push - Set return time (wait) of buttons (works for any game)
 
If you set the wait value to -1 after the entity has been spawned, it is effectively the same as setting the recovery time to 0. Instead you probably want to use a large number otherwise the buttons instantly recover.

Chanz 08-15-2010 16:12

Re: No Double Push - Locks buttons. (works for any game)
 
updated to v2.4.5
see first post for changelog.

Crimepack 09-08-2010 13:53

Re: No Double Push - Locks buttons. (works for any game)
 
I´m running an HL2DM Server, is it possible to lock the vent in dm_lockdown!

Hope you know which map and vent i mean! :-D

I installed your plugin, but nothing happened to the button, the vent turns and then the plug disconnected, i want to block / lock this! Hope you can help me to solve my problem!

Thanks for reply.

Chanz 09-16-2010 18:40

Re: No Double Push - Locks buttons. (works for any game)
 
Yes I know the vent shaft on lockdown.
This plugin isn't able to block the ventilator in dm_lockdown.

If you pay me 15$ then I'll code you a single plugin especially for dm_lockdown.


All times are GMT -4. The time now is 02:34.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.