So, I have this program that gets the playerCount and displays it as a notification, but for it to update, it has to be reloaded everytime, is there anyway that I can make it refresh itself?
This is the code I use to get the playerCount and display it:
Code:int playerCount = Singleton<GameManager>.Instance.GetPlayerCount();void OnPlayerConnected(PlayerSession session) { string showPlayers = playerCount.ToString(); AlertManager.Instance.GenericTextNotificationServer("Players: " + showPlayers, session.Player); }
Making a plugin refresh itself
Discussion in 'Hurtworld Development' started by cogu 2, Mar 1, 2016.
-
Wulf Community Admin
Use the timer library with Oxide to refresh the count. You don't need to reload the plugin.
-
I think you just should insert playerCount into OnPlayerConnected:
Code:void OnPlayerConnected(PlayerSession session) { int playerCount = Singleton<GameManager>.Instance.GetPlayerCount(); string showPlayers = playerCount.ToString(); AlertManager.Instance.GenericTextNotificationServer("Players: " + showPlayers, session.Player); }
Code:AlertManager.Instance.GenericTextNotificationServer("Players: " + showPlayers);