[DOUBLEPOST=1469759048][/DOUBLEPOST]if self.Timers[sid] ~= nil then self.Timers[sid]Code:18:40 [Info] (INFO): IcyNads ran /help 18:40 [Error] Failed to call hook 'OnHammerHit' on plugin 'rustyremovetool v1.0.0' File: rustyremovetool.lua Line: 253 attempt to call method 'Destroy' (a string value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 18:40 [Error] Failed to call hook 'OnHammerHit' on plugin 'rustyremovetool v1.0.0' File: rustyremovetool.lua Line: 253 attempt to call method 'Destroy' (a string value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 18:40 [Info] (ADMIN): Attempting to retrieve .#SiN!! Steam Hours... 18:40 [Info] (INFO): Updated .#SiN!! Steam Rust Hours with -1 hours. 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2193.5598189091) 18:40 [Error] Failed to call hook 'OnHammerHit' on plugin 'rustyremovetool v1.0.0' File: rustyremovetool.lua Line: 253 attempt to call method 'Destroy' (a string value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2191.536394062) 18:40 [Error] Failed to call hook 'OnHammerHit' on plugin 'rustyremovetool v1.0.0' File: rustyremovetool.lua Line: 253 attempt to call method 'Destroy' (a string value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2190.5491609894) 18:40 [Info] (INFO): [AIMBOT] Broderick redeemed basic kit. 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2190.0353777156) 18:40 [Info] (CHAT): :mad:: community is cancer 18:40 [Info] (CHAT): IcyNads: sethome 1 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2189.8823204632) 18:40 [Info] (INFO): Im a Lava Lamp redeemed basic kit. 18:40 [Error] Failed to call hook 'OnHammerHit' on plugin 'rustyremovetool v1.0.0' File: rustyremovetool.lua Line: 253 attempt to call method 'Destroy' (a string value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2189.9833185664) 18:40 [Info] (DEBUG:GLItCH): [6ix] Nigro => Rich Chigga (2190.2750853854) 18:40 [Info] (CHAT): :mad:: game is cancer 18:40 [Info] (CHAT): :mad:: gg 18:40 [Warning] Calling 'OnLootEntity' on 'QuickSort v1.0.1' took 344ms [GARBAGE COLLECT] 18:40 [Error] Failed to call hook 'cmdremove' on plugin 'rustyremovetool v1.0.0' File: rustyremovetool.lua Line: 41 attempt to call method 'Destroy' (a string value): at NLua.Lua.ThrowExceptionFromError (Int32 oldTop) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args, System.Type[] returnTypes) [0x00000] in <filename unknown>:0 at NLua.Lua.CallFunction (System.Object function, System.Object[] args) [0x00000] in <filename unknown>:0 at NLua.LuaFunction.Call (System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Ext.Lua.Plugins.LuaPlugin.OnCallHook (System.String hookname, System.Object[] args) [0x00000] in <filename unknown>:0 at Oxide.Core.Plugins.Plugin.CallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0estroy() end < -- destroy timer, started after todays update
Solved Error when destroying a timer (plugin issue)
Discussion in 'Rust Development' started by Rusty, Jul 29, 2016.
-
Wulf Community Admin
Your issue is mentioned in the error, you should be passing a Timer, not a string to Destroy(). The error is not from anything changed in the updates today, it's with your code. -
I havent changed that plugin in over 5 weeks..started today after update.
[DOUBLEPOST=1469759688][/DOUBLEPOST]Code:function PLUGIN:cmdremove( player,command, arg ) local sid = rust.UserIDFromPlayer(player) if removeTable.Users[sid] ~= nil then player:ChatMessage("Remove Tool is: <color=lime>OFF</color>" ) removeTable.Users[sid] = nil if self.Timers[sid] ~= nil then self.Timers[sid]:Destroy() end return end player:ChatMessage("Remove Tool is: <color=yellow>ON</color>, hit objects/structures with a Hammer to remove them, tool will disable itself after 30 seconds of inactivity." ) removeTable.Users[sid] = player global.Effect.server.Run.methodarray[3]:Invoke(nil, util.TableToArray( { "assets/bundled/prefabs/fx/weapons/landmine/landmine_trigger.prefab", player.transform.position, UnityEngine.Vector3.get_up(), nil, true } ) ) self.Timers[sid] = timer.Once(30, function() global.Effect.server.Run.methodarray[3]:Invoke(nil, util.TableToArray( { "assets/bundled/prefabs/fx/weapons/landmine/landmine_trigger.prefab", player.transform.position, UnityEngine.Vector3.get_up(), nil, true } ) ) player:ChatMessage("Remove Tool is: <color=lime>OFF</color>" ) --rust.SendChatMessage( removeTable.Users[sid], "Rusty", removeTable.Users[sid] = nil end,self.Plugin) end -
Wulf Community Admin
Timers working just fine in Lua:
Code:PLUGIN.Title = "TimerTest" PLUGIN.Version = V(0, 1, 0) PLUGIN.Description = "" PLUGIN.Author = "Wulf/lukespragg"local myTimer = nilfunction PLUGIN:Init() local i = 1 myTimer = timer.Repeat(1, 0, function() print("Timer interval: " .. i) i = i + 1 end, self.Plugin) endfunction PLUGIN:Unload() if myTimer ~= nil then myTimer:Destroy() print("Timer destroyed!") end end -
I would like to believe that. That plugin has been the same for 5 weeks. Ill let you figure it out. <3
-
Wulf Community Admin
There's nothing for me to figure out, I just gave you a working example of creating and destroying timers in Lua. It's not on our end. -
Proofed, what Wulf mentioned. Its not on Oxide's end... There's nothing to get figured out
-
k. i guess im an ah who doesnt kno what hes talking bout.
[DOUBLEPOST=1469762631][/DOUBLEPOST]Fuji: i reworked ur plugin, complete with weights. wasnt that hard.
[DOUBLEPOST=1469763621][/DOUBLEPOST]Cool, explai
n why it isnt working today. i didnt make any modifications in over a month.
[DOUBLEPOST=1469763790][/DOUBLEPOST]f0rum is broke too lol Gyazo - b565b874d1ccf5345aced0171d017dc5.png
[DOUBLEPOST=1469764009][/DOUBLEPOST]ill do everyone a favor. im out. -
Your error is in a place you didn't post.
The error is pretty clear and there is no way this issue can be caused by Oxide (that would mean that the error itself is incorrect).
There is also no way for timer.Once to return a string, as you can see in the source code (C# is a statically typed language - it wouldn't even pass the build process!).
It's a lot more likely that some user caused an invariant with a malicious input in your code, resulting in a string being added to the table, which isn't that unlikely in a dynamically typed language like Lua, or that you didn't consider some case where concurrency matters, and the error is the result of a race condition.
The timer library hasn't changed since the 9th of June, which is quite a lot longer than your described five weeks.
Proof: Oxide/Timer.cs at develop · OxideMod/Oxide · GitHub
Also, on a side note, attacking people passive-agressively will not help with your issue. -
Ok thanks, sorry for being rude. This is the code that used to work before last update, and now it isnt, any help would be appreciated.
Code:global.ConsoleNetwork.BroadcastToAllClients("ddraw.text", 60, System.ConsoleColor.Lime, pos, "<color=lime>" .. "X" .. "</color>") -
Wulf Community Admin
The ddraw.text command is broken in Rust, they will need to fix it. This isn't related to timers though. -
Any alternatives to ddraw right now? I was able to resolve the timers issue..
-
Wulf Community Admin
Not for drawing text, what do you need it for? -
Just need an X drawn on players screen (all players) on a certain world vector3 var (pos)
[DOUBLEPOST=1469845356][/DOUBLEPOST]I dont mind waiting if theres going to a fix soon, what i dont want to do is cycle through all players to apply it. ZERO priority. -
You reworked what?
-
Yes..total pain. But i got it working.
[DOUBLEPOST=1469845554][/DOUBLEPOST]@Wulf if theres an easy way for me to broadcasttoall using a box or any other kind of marker i would be all set, doesnt need to be an X . could be a real small rectangle. -
Wulf Community Admin
Yes, take a look at my Inbound plugin. There are other ddraw commands that work just fine right now. -
I see, is arrow the only ddraw method working right now for broadcasttoall?
-
Wulf Community Admin
I haven't tried the others, but you can test them if you'd like. You can find the others either in the game's DLL or by using the 'find ddraw' command in Rust. -
I will. Thanks for putting up with me. And again beaucoup apologies for my not so manly posts at times.
