Raised This Month: $344 Target: $400
 86%   Almost there!

Reload a plugin every X seconds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 08-05-2022 , 18:47   Reload a plugin every X seconds
Reply With Quote #1

There is a plugin that usually stop functioning for one player and the only solution I know of is to reload it. Every five minutes would be fine, but I only know how to do it manually when a player tells me it's failing to him. I want to automate it, how can I do it?

Last edited by Toranks; 08-05-2022 at 18:47.
Toranks is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 08-05-2022 , 22:57   Re: Reload a plugin every X seconds
Reply With Quote #2

better focus in fixing the issue
__________________
Marttt is online now
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 08-07-2022 , 23:26   Re: Reload a plugin every X seconds
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
better focus in fixing the issue
If Silvers can't, even less so, I have no idea...

https://forums.alliedmods.net/showpo...&postcount=127
Toranks is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-08-2022 , 04:01   Re: Reload a plugin every X seconds
Reply With Quote #4

With such old code and syntax, variables named that's confusing, my eyes started to bleed. Would be better to re-write the plugin since that one has a severe lack of optimization and convoluted methods.
__________________
Silvers is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 08-08-2022 , 12:17   Re: Reload a plugin every X seconds
Reply With Quote #5

If you want this "fixed" try finding where is the issue and then ask for help, giving more technical and detailed info.

Requesting someone (that isn't even the author) to read 1800+ lines of code + old syntax and fix it for you, and for free, it's too lazy.

band-aid fixes usually only bring more issues than fixes.

Try removing (set to 0 or a bigger value) any fatigues changing the cvars belows:

Code:
z_gun_swing_coop_max_penalty             : 8        : , "rep", "cl", "launcher" : **The number of swings before the maximum punch/melee/shove fatigue delay is set in (coop).
z_gun_swing_coop_min_penalty             : 5        : , "rep", "cl", "launcher" : **The number of swings before the minimum punch/melee/shove fatigue delay is set in (coop).
z_gun_swing_vs_max_penalty               : 6        : , "rep", "cl", "launcher" : **The number of swings before the maximum punch/melee/shove fatigue delay is set in (vs).
z_gun_swing_vs_min_penalty               : 3        : , "rep", "cl", "launcher" : **The number of swings before the minimum punch/melee/shove fatigue delay is set in (vs).
Looking at the plugin code there is nothing messing with fatigue netprop (m_iShovePenalty) from clients so I don't know if it was implemented properly
__________________
Marttt is online now
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 08-09-2022 , 03:09   Re: Reload a plugin every X seconds
Reply With Quote #6

Quote:
Originally Posted by Marttt View Post
If you want this "fixed" try finding where is the issue and then ask for help, giving more technical and detailed info.

Requesting someone (that isn't even the author) to read 1800+ lines of code + old syntax and fix it for you, and for free, it's too lazy.
Hey, I didn't request anything, I already tried it on my own. Silvers volunteered upon seeing the post, not at my request.
And you have explained well the reasons why I find it much more comfortable to reload the plugin from time to time than to fix it directly, since it is a rare error, approximately once every hour.
Toranks is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 08-09-2022 , 06:28   Re: Reload a plugin every X seconds
Reply With Quote #7

Hello, for reload the plugin this should works
PHP Code:
#include <sourcemod>

#define TIMER_INTERVAL 300.0
#define PLUGIN_NAME "l4d2_meleemod2.2.1"

public void OnPluginStart()
{
    
CreateTimer(TIMER_INTERVALTimer_Reload_TIMER_REPEAT);
}

public 
Action Timer_Reload(Handle timer)
{
    
ServerCommand("sm plugins reload %s"PLUGIN_NAME);

You can change the define values and compile here.
__________________
Veteran SourceMod Coder -> Activity channel
Taking paid and free jobs.
Contact: Steam, Telegram or discord ( Franc1sco#7876 ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
Toranks
Senior Member
Join Date: Dec 2021
Location: Spain
Old 08-11-2022 , 05:07   Re: Reload a plugin every X seconds
Reply With Quote #8

Quote:
Originally Posted by Franc1sco View Post
Hello, for reload the plugin this should works
PHP Code:
#include <sourcemod>

#define TIMER_INTERVAL 300.0
#define PLUGIN_NAME "l4d2_meleemod2.2.1"

public void OnPluginStart()
{
    
CreateTimer(TIMER_INTERVALTimer_Reload_TIMER_REPEAT);
}

public 
Action Timer_Reload(Handle timer)
{
    
ServerCommand("sm plugins reload %s"PLUGIN_NAME);

You can change the define values and compile here.
Thanks!
Trying to find some plugin that activates fatigue for melee during further extensive searching, I couldn't find anything.
This will do the job in the meantime.
Toranks is offline
Tonblader
Senior Member
Join Date: Jul 2011
Location: Peru
Old 08-11-2022 , 17:03   Re: Reload a plugin every X seconds
Reply With Quote #9

Quote:
Originally Posted by Toranks View Post
Thanks!
Trying to find some plugin that activates fatigue for melee during further extensive searching, I couldn't find anything.
This will do the job in the meantime.
Since you are still looking for something, you could use this plugin ( [Any] Delay Command ) and load automatically via a cfg file infinite times.
I explain:
create a file for example: automatic.cfg
put it in: Steam\SteamApps\common\Left 4 Dead 2\left4dead2\cfg
inside it, type these commands:
PHP Code:
sm_delaycmd_rcon 300 exec automatic.cfg //this repeat infinitely every 5 minutes with this command
whrite you commands here 
and finally in your server.cfg (dedicated server) or listenserver.cfg (listening server), add this command so that it is executed 1 time when you start the game:
PHP Code:
exec automatic.cfg 
Tonblader is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:10.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode