What I'm doing wrong?
Code:using System.Collections.Generic; using System; using System.Reflection; using System.Text; using UnityEngine; using Oxide.Core;namespace Oxide.Plugins { [Info("TDCCore", "Insane", "0.0.1", ResourceId = 851)] class TDCCore: RustPlugin { [HookMethod("testm")] public String testm() { return "WORKING HOOK"; } } }Code:using System.Collections.Generic; using System; using System.Reflection; using System.Text; using UnityEngine;using Oxide.Core; using Oxide.Core.Configuration; using Oxide.Core.Plugins;namespace Oxide.Plugins { [Info("InfoPlugin", "Insane", "0.0.1", ResourceId = 851)] class InfoPlugin: RustPlugin { [PluginReference("TDCCore")] private Plugin TDCCore; [ChatCommand("help")] void help(BasePlayer player, string command, string[] args) { // ... .... .... / try { player.ChatMessage(TDCCore.CallHook("testm", null).ToString()); } catch (Exception ex) { Puts(ex.ToString()); } } } }Code:[Oxide] 12:44 AM [Info] System.NullReferenceException: Object reference not set to an instance of an object at Oxide.Plugins.InfoPlugin.help (.BasePlayer player, System.String command, System.String[] args) [0x00000] in <filename unknown>:0
Solution:
Code:[PluginReference("TDC_Core")] Plugin PTDCCore; ... PTDCCore.Call("method", arg1, arg2, arg3);
Solved Calling my core plugin? (C#)
Discussion in 'Rust Development' started by TDC | Insnee, May 20, 2015.
-
Check if tddcore is null also make your hook method private.
-
tdccore is null
How can I fix this?Last edited by a moderator: May 21, 2015 -
Code:[PluginReference] Plugin MyPlugin;
Code:[PluginReference("m-Teleportation")] Plugin Teleporter;
Code:bool running = MyPlugin?.Call("IsRunning"); string msg = MyPlugin?.Call("GetMessage", "WelcomeMessage");
-
Thank you so far.
Another question:
To send arguments, the normal way should be sth. like
.Call("method", new Object[]{"string",12})
How can I do this with Oxide Plugin System?
Edit: K, simply add arg to arg with commasLast edited by a moderator: May 21, 2015