TimedEvents changed in pluton. From now on TimedEvent "Callback"s will always have a parameter and that's the timer itself. And I'm introducing the parallel timed events:
Parallel timed events can run simultaneously with the same name and with different data. You can put player in the dictionary or steamid, whatever you want. Plugin.CreateDict() will give you a Dictionary<string, object>, by default it's capacity is 10, you can call it with CreateDict(int capacity) if you have to.
If you want to get only one timer of all with the same name, for example if you want to kill the timers that ran ten times:
if you wish to kill all parallel timer with the same name:
Plugin.KillParrallelTimer("delayedJoin")
GetTimer("delayedJoin") won't give back timer if the timer was defined to be a parallel timer
KillTimer("delayedJoin") won't kill any of your parallel timer
KillTimers() will do that tho.
a ParallelTimer always needs a dictionary for the data
Python:
def On_PlayerConnected(self, player):
myDict = Plugin.CreateDict()
myDict["joined"] = player
Plugin.CreateParallelTimer("delayedJoin", 5000, myDict).Start()
def delayedJoinCallback(self, timer):
if timer.Args["joined"].Name == "Illuminati":
timer.Args["joined"].Kick("for good")
timer.Kill()
If you want to get only one timer of all with the same name, for example if you want to kill the timers that ran ten times:
Python:
for timer in Plugin.GetParallelTimer("delayedJoin"):
if timer.ElapsedCount == 10:
Debug.Log("timer ran 10 times already")
timer.Kill()
Plugin.KillParrallelTimer("delayedJoin")
GetTimer("delayedJoin") won't give back timer if the timer was defined to be a parallel timer
KillTimer("delayedJoin") won't kill any of your parallel timer
KillTimers() will do that tho.
a ParallelTimer always needs a dictionary for the data
Last edited: