1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  1. denDAY04

    denDAY04 Naked Wanderer

    So, I'm trying doing something as simple as the code written in the documentation, i.e.
    Code (Text):
    using Oxide.Plugins;

    namespace Oxide.Plugins {
        [Info("ChatServerRules", "denDAY04", "0.0.2")]
        [Description("Print server rules to player's chat by !rules input.")]
        class ChatServerRules : SevenDaysPlugin {

            void OnPlayerChat(string message, string name) {
                Puts("OnPlayerChat works!");
    But this generates the following exception:
    Code (Text):
    20:23 [Error] Failed to call hook 'OnPlayerChat' on plugin 'ChatServerRules v0.0.2' (InvalidCastException: Cannot cast from source type to destination type.)
    20:23 [Stacktrace]   at Oxide.Plugins.ChatServerRules.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
      at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0
    So, what exactly is the problem here?
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    It's actually OnPlayerChat(ClientInfo client, string message). I've updated it in the Docs now.