i know pain has something like this but this must be just for radiation so its diff purpose for me
im getting somewhere im just stuck on the timer command keeps giving all sorts of diff errors
i know its not good or the best but i like the idea
id like to add a config file that alows to change the rotation times but i cant get this working
u may luagh cause im sure youd find this a funny crap piece of work but i realy want to make it work
im no dev but im trying to learn
Code:using UnityEngine; namespace Oxide.Plugins { [Info("RadiationRotation", "Toaster", 0.1, ResourceId = xxx)] [Description("Rotate Radiation 0/1 every (x) seconds.")] class RadiationRotation : RustPlugin{ timer.Repeat(10, 0,radiation 1() => PrintToChat("radiation on!")); private void SaveCommand(ConsoleSystem.Arg arg) { { timer.Repeat(10, 0,radiation 0() => PrintToChat("radiation off!")); private void SaveCommand(ConsoleSystem.Arg arg) {} } }
Timer.repeat just dont understand
Discussion in 'Rust Development' started by Toaster, Oct 23, 2015.
-
Wulf Community Admin
There may be a way to do this with less code, but as a working example... filename RadRotate.cs:
Code:namespace Oxide.Plugins { [Info("RadRotate", "Toaster", 0.1, ResourceId = 0)] [Description("Toggle radiation every (x) seconds.")] class RadRotate : RustPlugin { void OnServerInitialized() { var radiation = true; timer.Repeat(10, 0, () => { if (!radiation) { radiation = true; ConsoleSystem.Run.Server.Normal("server.radiation", radiation.ToString()); PrintToChat("Radiation is on!"); Puts("Radiation is on!"); return; } if (radiation) { radiation = false; ConsoleSystem.Run.Server.Normal("server.radiation", radiation.ToString()); PrintToChat("Radiation is off!"); Puts("Radiation is off!"); return; } }); } } }
Last edited: Oct 23, 2015 -
thank you so much for the reply i have a question though im slowly learning about all these c# things so i too can create plugins
which value changes the timer
and can i put this on oxide plugins when ive got it working so anyone can use it -
Wulf Community Admin
I'd recommend getting a bit more familiar with it before releasing a plugin so that you're able to maintain it. -
wil do il test it and play with it until i can understand every part of it i just dont know where to get information i need really only place i found was the api for rust and that is still little confusing to me but il learn as much as i can might just take a while
once again thank you so much this does make things easier my father in law knows c# so il have him explain more for me step by step