ParallelTimer is not callingback? No errors.
I need a second pair of eyes to go over this.. I've been over this a million times and can not find out why its not calling back.
Tried on 1.1.6 and 1.1.7D
I need a second pair of eyes to go over this.. I've been over this a million times and can not find out why its not calling back.
Tried on 1.1.6 and 1.1.7D
Python:
elif cmd == "vtp":
users = self.getUserIni()
if users.GetSetting(Player.SteamID, "VTP") == "true" or Player.Admin:
if len(args) == 0:
ds = DataStore.Keys("DonatorRank")
count = 1
Player.Message("Usage: /vtp [Number]")
for key in ds:
if key == "VTP" + str(count):
Player.Message(str(count) + ") - " + DataStore.Get("DonatorRank", key))
count += 1
elif len(args) == 1:
waittime = int(DataStore.Get("DonatorRank", "VTPCoolDown"))
time = DataStore.Get("VTPCooldown", Player.SteamID)
time = int(time)
if time is None:
time = 0
calc = System.Environment.TickCount - time
if DataStore.Get("DonatorRank", "VTP" + args[0]) is not None:
if calc >= waittime or Player.Admin:
delay = DataStore.Get("DonatorRank", "VTPDELAY")
locname = DataStore.Get("DonatorRank", "VTP" + args[0])
Data = Plugin.CreateDict()
Data["PlayerID"] = Player.SteamID
Data["LocationName"] = locname
Data["Location"] = DataStore.Get("DonatorRank", locname).split(",")
Plugin.CreateParallelTimer("TeleportDelay", delay * 1000, Data).Start()
Player.Message("Teleporting in " + str(delay) + " seconds.")
#DataStore.Add("VTPCooldown", Player.SteamID, System.Environment.TickCount)
Player.MessageFrom("DEBUG", "Sending: " + Player.FindBySteamID(List["PlayerID"]).Name + " to location: " + List["LocationName"])
Player.MessageFrom("DEBUG", List["LocationName"] + " = " + str(List["Location"][0] + "," + List["Location"][1] + "," + List["Location"][2]))
else:
workingout = (round(waittime / 1000, 2) / 60) - round(int(calc) / 1000, 2) / 60
current = round(workingout, 2)
Player.Message(str(current) + " Minutes remaining before you can use this.")
else:
Player.Message("Usage: /vtp [Number]")
else:
Player.Message("Usage: /vtp [Number]")
else:
Player.Message("You don't have permission to use this command!")
def TeleportDelayCallback(self, timer):
timer.Kill()
Util.Log("CALLED BACK")
Data = timer.Args
Player = Player.FindBySteamID(Data["PlayerID"])
if Player is not None:
locname = Data["LocationName"]
loc = Data["Location"]
Player.TeleportTo(float(loc[0]), float(loc[1]), float(loc[2]))
Player.InventoryNotice(locname)
else:
Util.Log("Failed")