I'm trying to add a function/void to a plugin that will display a simple message when it becomes night, but it doesn't seem to work. I'm still new to C# and might not be using the right hook.
Code:private void NightMessage(BasePlayer player, string message, string[] args) { TOD_Sky Sky = TOD_Sky.Instance; if (Sky.IsNight) { PrintToChat(player, "As night grows near, gathering rates increase to 5x."); } }
Solved Message not being displayed (C#)
Discussion in 'Rust Development' started by Alpha Toon, Jun 9, 2016.
-
How are you calling the function? Chat command? Also PrintToChat only takes a string for its parameter, it doesn't require a BasePlayer. If you want to message a player use SendReply(BasePlayer, string)
-
To actually display the message when it is night you will need to handle things differently however, your current code wouldn't run on its own when it becomes night, you either have to use the event system that the TOD system has in place or use a repeating timer to continuously check if it has become night or not depending on how experienced you are with C# and Oxide. -
Last edited by a moderator: Jun 9, 2016
-