PaiN submitted a new resource:
TimedExecute - Executes a command every (x) seconds.
Read more about this resource...
TimedExecute [Unmaintained]
Discussion in 'Plugin Support' started by PaiN, Apr 7, 2015.
-
Wulf Community Admin
Congrats on your first plugin! I did notice a few issues though, especially with config generation. I made a more simplistic version below, which I'd recommend using as it fixes a couple issues, removes a lot of unused/uneeded code, and provides a better config and command run verification.
Code:PLUGIN.Title = "TimedExecute" PLUGIN.Version = V(0, 1, 0) PLUGIN.Description = "Executes a command every (x) seconds." PLUGIN.Author = "Merka"function PLUGIN:LoadDefaultConfig() self.Config.Commands = { { command = "server.save", interval = 300 }, { command = "say 'hello world'", interval = 600 } } endfunction PLUGIN:OnServerInitialized() for i, item in ipairs(self.Config.Commands) do timer.Repeat(item.interval, 0, function() print("[" .. self.Title .. "] Ran command: " .. item.command) rust.RunServerCommand(item.command) end, self.Plugin) end end
-
Nice Plugin mate!
-
-
Nice work on your first plugin
-
-
Nice one Pain... I know you've been keen to get started.... I really need to work on mine.
-
-
Anyone got a config for automatic server restart with coundown timer?
Already got a script to restart it once it hangs or shutdowns.
But would be nice to use the ingame restart function, maybe every 4 hours or so. -
should work? -
Like this?
RustDedicated.exe -batchmode +global.restart 2400Last edited by a moderator: Apr 11, 2015 -
Code:{ "ShowTimedCommands": "true", "TimedCommands": [ [ "restart", 2400 ] ] }
-
Thanks! Just thought I might be able to use the command from server startup command line.
-
Can I use this to run another plugin's chat commands? I want to use this http://oxidemod.org/plugins/clean-up-count-informations.711/ and run these chat commands:
- /clean trees 0-1 => will clean 0% to 100% of the trees.
- /clean animals 0-1 => will clean 0% to 100% of the animals.
Is this possible? -
-
maybe it could just give me the plugin so i can edit it and add a console command if there are only chat commands
-
hey for some reason it dosnt work like it should, it annouces the Server restart on same time at 5hours and 3hours but they got diffrent timers.
Code:{ "ShowTimedCommands": "true", "TimedCommands": [ [ "event.run", 3600 ], [ "say TRIPLE AIRDROP INCOMING!!!", 3600 ], [ "event.run", 3600 ], [ "event.run", 3600 ], [ "restart", 21600 ], [ "server.save", 21400 ], [ "say SERVERRESTART in 5 hours!", 3600 ], [ "say SERVERRESTART in 4 hours!", 7200 ], [ "say SERVERRESTART in 3 hours!", 10800 ], [ "say SERVERRESTART in 2 hours!", 14400 ], [ "say SERVERRESTART in 1 hour!", 18000 ], [ "say SERVERRESTART in 30 min!", 19800 ], ] }
-
-
Can't test it directly but I will try it ... but I can't say directly if it works cuz I must wait the timers. Btw pls add that it is printed in server.logs.