1. I'll be posting my questions in this Thread so I don't flood the forum.
    I'm working on making the plugin that I suggested here:

    I'm currently Stuck on a problem of trying to call a hook from a different plugin. I'm using ZoneManger to create and handle the zones. http://oxidemod.org/plugins/zones-manager.739/
    Code:
    function PLUGIN:cmdSetProtected(player)
        rust.SendChatMessage(player, "NOR-Plugin", "Set Protected Command(test)")
         if not plugins.Exists( "ZoneManager" ) then
             rust.SendChatMessage(player, "NOR-Plugin", "ZoneManager Plugin Not Found!")
             return
         end     --bool CreateOrUpdateZone(string ZoneID, string[] args, Vector3 position = default(Vector3))
         rust.SendChatMessage(player, "NOR-Plugin", "Createing protected Zone for " .. tostring(player.name))
         local ZoneID = "Test"
         local zoneArgs = {}
            zoneArgs[0] = "name"
            zoneArgs[1] =  "Test"
            zoneArgs[2] = "enter_message"
            zoneArgs[3] = "Test Zones!"
            zoneArgs[4] = "radius"
            zoneArgs[5] = "120"     
         if not plugins.CallHook("CreateOrUpdateZone", ZoneID, util.TableToArray(zoneArgs), player.transform.position) then
             rust.SendChatMessage(player, "NOR-Plugin", "Created Zone - FAILED")
             return
         else
             rust.SendChatMessage(player, "NOR-Plugin", "Created Zone - Zone id= " .. tostring(player))
        end
    end
    After using the chat command to call the function above I get the Error below. Line 60 is the line with "util.TableToArray(zoneArgs)"

    Code:
    [Oxide] 7:50 PM [Error] Failed to call hook 'cmdSetProtected' on plugin 'No Offline Raiding'
    File: NoOfflineRaid.lua Line: 60 Specified table is not an array:
      at Oxide.Ext.Lua.Libraries.LuaUtil.TableToArray (NLua.LuaTable table) [0x00000] in <filename unknown>:0
      at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
    Anyways I feel like it's a syntax problem but I'm not familiar enough with LUA, etc to notice what exactly.
    Any help anyone can provide would be awesome.
    Thanks!
     
    Last edited by a moderator: May 30, 2015
  2. Lua tables aren't zero-indexed, try starting at 1 and see if chat still gives the error. You could also try to use table.insert(yourtable, value) instead of doing it how you are currently doing it.
     
  3. is this mod up?