I'm trying to add this to gather manager instead of using it in my own plugin and OnTick seems to fail when I load the plugin.
Screenshot
The OnTick function
dayNightCycle functionCode:void OnTick() { if (RateMessagesEnabled) { dayNightCycle(); } }
VariablesCode:private void dayNightCycle() { double currentTime = TOD_Sky.Instance.Cycle.Hour; if ( currentTime >= sunsetHour && FirstEveningCheck ) { FirstMorningCheck = true; FirstEveningCheck = false; FirstNightCheck = true; PrintToChat(string.Format("[<color={ChatPrefixColor}>{ChatPrefix}</color>]: <size={MessageSize}>{NMessage}</size>")); } else if ( currentTime >= sunriseHour && currentTime < sunsetHour && FirstMorningCheck ) { FirstMorningCheck = false; FirstEveningCheck = true; FirstNightCheck = true; PrintToChat(string.Format("[<color={ChatPrefixColor}>{ChatPrefix}</color>]: <size={MessageSize}>{DMessage}</size>")); } else if ( currentTime < sunriseHour && FirstNightCheck ) { FirstMorningCheck = true; FirstEveningCheck = true; FirstNightCheck = false; } }
If someone could help me with this, i'd really appreciate it.Code:sunriseHour = Convert.ToInt32(GetConfigValue("Settings", "sunriseHour", "5")); sunsetHour = Convert.ToInt32(GetConfigValue("Settings", "sunsetHour", "19")); RateMessagesEnabled = Convert.ToBoolean(GetConfigValue("Settings", "RateMessages", true));
Solved OnTick failing when I load my plugin
Discussion in 'Rust Development' started by Alpha Toon, Jun 9, 2016.
-
Read the following: https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx
What you're trying to do is string interpolation: Interpolated Strings (C# and Visual Basic Reference) -