Solved Detecting explosive usage?
Discussion in 'Rust Development' started by CrazyDoo, Sep 11, 2016.
-
Wulf Community Admin
You can hook into the OnExplosiveThrown hook, which should cover that I think.
-
Thanks but im new in a coding lua plugin for oxide :s where i find a complet doc for the method OnExplosiveThrown ?
-
You can find it here: Oxide API for Rust
-
Thanks but i know this website :s
With lua code :
I have error :Code:function PLUGIN:OnExplosiveThrown(player, entity) print("plugin test".."name :"..name.."entity :"..entity) end
Code:[Oxide] 14:45 [Error] Failed to call hook 'OnExplosiveThrown' on plugin 'test v0.0.1' File: test.lua Line: 17 attempt to concatenate local 'entity' (a userdata 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
-
Wulf Community Admin
You wouldn't be able to print the entire entity, you'd have to transverse it a bit to get something you can. -
But im new :s its possible of you help me ?
-
Wulf Community Admin
Do you want someone to write it for you or do you want to learn how to do it?
entity.name, entity.OwnerID, entity.PrefabName, etc. -
Thanks, i need to learn all in the lua code for oxide because i started sunday when i sended my first post

Where i find all method "entity.name, entity.OwnerID, entity.PrefabName, etc. " ? -
Wulf Community Admin
All of that is located in Rust itself, which you can find using a decompiler such as JustDecompiler and Rust's Assembly-CSharp.dll. -
Thanks, im download now the JustDecompiler ^^
[DOUBLEPOST=1473860661][/DOUBLEPOST]In the Assembly-CSharp.dll i don't find the list with "entity.name, entity.OwnerID, entity.PrefabName, etc."
what is the path tree ? -
How to cancel the launch explosif in "OnExplosiveThrown" ?
-
Wulf Community Admin
You'd have to use Rust methods to kill/destroy/remove the entity. -
this would for example stop the Explode:
Code:void OnExplosiveThrown(BasePlayer player, BaseEntity entity) { if (entity != null && entity is TimedExplosive) { entity.CancelInvoke("Explode"); } }
