Search the Community
Showing results for tags 'timer'.
-
Version 2.1
708 downloads
With this script you can easily create custom timer. The file is fully commented and should be easy to understand. The file in Shared is required - and then use either the file in Server or in Client depending on where you are using it. You have to use the constructor to create the timer. Examples: Examples: // Yes, the method can be private // private void testTimerFunc(Client player, string text) { NAPI.Chat.SendChatMessageToPlayer(player, "[TIMER] " + text); } void testTimerFunc() { NAPI.Chat.SendChatMessageToAll("[TIMER2] Hello"); } [Command("ttimer")] public void timerTesting(Client player) { // Lamda for parameter // new Timer(() => testTimerFunc(player, "hi"), 1000, 1); // Normal without parameters // new Timer(testTimerFunc, 1000, 1); // Without existing method // var timer = new Timer(() => { NAPI.Chat.SendChatMessageToPlayer(player, "[TIMER3] Bonus is da best"); }, 1000, 0); // Kill the timer // timer.Kill(); } -
Hi, i'm looking for best solution to create timer, who is starting always when player is logging and stoping when he's leaving. I tried with this: function timeout() { setTimeout(function () { //something to do timeout(); }, 10000); } timeout(); But i don't know how to stop this timer's function. It's of course via server-side but how can I create timer for each players? I wanna do something for player when he's long enough time on the server in the same session.