HelpText

Moved

Total Downloads: 18,186 - First Release: Oct 23, 2014 - Last Update: Feb 3, 2017

4.92105/5, 38 likes
  1. Is it possible to create on the basis of this plug another plug-in that would show different text?
    I am very badly I know programming languages. Could you suggest how to copy the plug-in but with a new team. For example: / servinfo but it has to work / help
     
  2. Wulf

    Wulf Community Admin

    It already exists. http://oxidemod.org/plugins/custom-chat-commands.649/
     
  3. When putting in custom helptext, is there something I can add to the line so it only shows for admins? (Not related to the admin helptext sent by other plugins)
     
  4. Wulf

    Wulf Community Admin

    You'd have to modify the plugin itself, for all of it.
     
  5. I'll stick to a piece of paper with commands for the old people running my server then, hah.
     
  6. Hey Domestos,

    i would like to use your helptext code for another plugin. I would like to ask for your permission to do so.
    I would like to give the help text out in a GUI instead of the chat.
     
  7. Wulf

    Wulf Community Admin

    It'd be better for this plugin to add it rather than copying it to create an identical plugin.
     
  8. I just would like to use the functionallity of getting the help info from other plugins and then give it out in a GUI instead of the chat.
     
  9. Im fine if you want to use parts of the code.
     
  10. Got sick of waiting and wrote the feature myself (this might have a bit more then just a sorted help list :x)

    @Domestos: feel free to adjust the Author stuff and such and provide it on your own, I don't really care, but it's something that probably needs to be adapted to every plugin :x

    It would be more ideal if this functionallity was built into the oxide core itself, maybe someday~

    Feel free to view this version live on games.win.yas-online.net:28015

    Edit: fixed a few problems with parsing the arguments -- 07:25 06.08.2015

    Code:
    PLUGIN.Title  = "Help"
    PLUGIN.Description  = "Provides /help for general info and / or plugin related info"
    PLUGIN.Author  = "Neico"
    PLUGIN.Version  = V( 2, 0, 0 )
    PLUGIN.HasConfig  = true
    PLUGIN.ResourceID  = 676local g_tPluginHelp = {}local function FindHelp( hPlugin )
       if hPlugin.Object.OnHelp ~= nil then
         -- Is it a Lua Plugin?
         if type( hPlugin.Object.OnHelp ) == "function" then
           local Result = hPlugin.Object:OnHelp()       local sResultType = type( Result )
           if sResultType == "table" then
             if Result["commands"] then
               g_tPluginHelp[hPlugin.Title] = Result
             else
               print( "[Help] " .. hPlugin.Title .. " passed non-valid data to OnHelp" )
             end
           end
         -- Let THE PAIN begin...
         else
           local Result = hPlugin:CallHook( "OnHelp" )
           local sResult = tostring( Result )       -- Is it a C# Plugin or a JavaScript one?
           if sResult:find( "System.Collections.Generic.Dictionary" ) or sResult:find( "System.Dynamic.ExpandoObject" ) then
             for _, hKey in pairs( util.EvaluateEnumerable( Result ) ) do
               local sKey = hKey.Key           if sKey == "commands" then
                 g_tPluginHelp[hPlugin.Title] = { [sKey] = {} }             for _, hCommand in pairs( util.EvaluateEnumerable( hKey.Value ) ) do
                   local sCommand = hCommand.Key               g_tPluginHelp[hPlugin.Title][sKey][sCommand] = {}               for _, hHelp in pairs( util.EvaluateEnumerable( hCommand.Value ) ) do
                     local sHelp = hHelp.Key                 g_tPluginHelp[hPlugin.Title][sKey][sCommand][sHelp] = hHelp.Value
                   end
                 end
               else
                 print( "[Help] " .. hPlugin.Title .. " passed non-valid data to OnHelp" )
               end
             end
           -- Is it a Python Plugin?
           elseif sResult:find( "IronPython.Runtime.PythonDictionary" ) ~= nil then
             for _, sKey in pairs( util.EvaluateEnumerable( Result ) ) do
               if sKey == "commands" then
                 g_tPluginHelp[hPlugin.Title] = { [sKey] = {} }             local hCommands = Result:get( sKey )             for _, sCommand in pairs( util.EvaluateEnumerable( hCommands ) ) do
                   g_tPluginHelp[hPlugin.Title][sKey][sCommand] = {}               local hHelp = hCommands:get( sCommand )               for _, sHelp in pairs( util.EvaluateEnumerable( hHelp ) ) do
                     g_tPluginHelp[hPlugin.Title][sKey][sCommand][sHelp] = hHelp:get( sHelp )
                   end
                 end
               else
                 print( "[Help] " .. hPlugin.Title .. " passed non-valid data to OnHelp" )
               end
             end
           end
         end
       end
    endfunction PLUGIN:Init()
       local hPlugins = plugins.GetAll()
       for i = 0, hPlugins.Length - 1 do
         FindHelp( hPlugins[i] )
       end   command.AddChatCommand( "help", self.Plugin, "Command_Help" )
       self:LoadDefaultConfig()
    endfunction PLUGIN:LoadDefaultConfig()
       self.Config.Settings               = self.Config.Settings or {}
       self.Config.Settings.CallHelpOnPlugins       = self.Config.Settings.CallHelpOnPlugins or true
       self.Config.Settings.CallLegacyHelpOnPlugins   = self.Config.Settings.CallLegacyHelpOnPlugins or false
       self.Config.Settings.EnableHeader         = self.Config.Settings.EnableHeader or false
       self.Config.Header                 = self.Config.Header or {}
       self.Config.Settings.EnableFooter         = self.Config.Settings.EnableFooter or false
       self.Config.Footer                 = self.Config.Footer or {}   self:SaveConfig()
    endfunction PLUGIN:OnPluginLoaded( hPlugin )
       if hPlugin.Title == self.Title then return end   FindHelp( hPlugin )
    endfunction PLUGIN:OnPluginUnloaded( hPlugin )
       if hPlugin.Title == self.Title then return end   g_tPluginHelp[hPlugin.Title] = nil
    endfunction PLUGIN:Command_Help( pPlayer, szCommand, pArgs )
       if self.Config.Settings.EnableHeader then
         for _, sText in pairs( self.Config.Header ) do
           rust.SendChatMessage( pPlayer, sText )
         end
       end   if self.Config.Settings.CallHelpOnPlugins then
         if not next( g_tPluginHelp ) then
           rust.SendChatMessage( pPlayer, "No plugins with help available..." )
         else
          local sArgs = ""       if pArgs.Length == 0 then
             rust.SendChatMessage( pPlayer, "Choose one of the Categories:" )
           else
             sArgs = pArgs[0]:lower()
        
             for i = 1, pArgs.Length - 1 do
               sArgs = sArgs .. " " .. pArgs[i]:lower()
             end
           end       for sPluginName, tHelp in pairs( g_tPluginHelp ) do
             if pArgs.Length == 0 then
               local sPluginName = sPluginName
               if sPluginName:find( "%s" ) then sPluginName = "\"" .. sPluginName .. "\"" end           rust.SendChatMessage( pPlayer, "\t" .. "/" .. "help " .. sPluginName --[[.. " - " .. "ToDo"]] )
             elseif sArgs == "all" or sArgs == sPluginName:lower() then
               if sArgs == "all" then
                 rust.SendChatMessage( pPlayer, "Showing help for all plugins:" )
               else
                 rust.SendChatMessage( pPlayer, "Showing help for " .. sPluginName .. ":" )
               end           -- ToDo: permissions
               if next( tHelp["commands"] ) then
                 for sCommand, tCommand in pairs( tHelp["commands"] ) do
                   rust.SendChatMessage( pPlayer,  "\t" .. tCommand["usage"]:format( "/" .. sCommand ) .. " - " .. tCommand["description"] )
                 end
               else
                 rust.SendChatMessage( pPlayer,  "\tNo commands available..." )
               end           break
             else
               rust.SendChatMessage( pPlayer, "invalid argument passed" )
             end
           end
         end
       end   -- for compatibility with older plugins
       if self.Config.Settings.CallLegacyHelpOnPlugins then
         plugins.CallHook( "SendHelpText", util.TableToArray( { pPlayer } ) )
       end   if self.Config.Settings.EnableFooter then
         for _, sText in pairs( self.Config.Footer ) do
           rust.SendChatMessage( pPlayer, sText )
         end
       end
    end
    
    Here are example's for how developers can use it:

    Lua:
    Code:
    function PLUGIN:OnHelp()
        return
        {
            ["commands"] =
            {
                ["help"] =
                {
                    ["description"] = "Shows this help",
                    ["usage"] = "%s [<plugin name>]",
                    ["permission"] = ""
                }
            }
        }
    end
    
    C#:
    Code:
    Dictionary<object, object> OnHelp()
    {
        return new Dictionary<object, object>()
        {
            ["commands"] = new Dictionary<object, object>()
            {
                ["help"] = new Dictionary<object, object>()
                {
                     ["description"] = "Shows this help",
                     ["usage"] = "%s [<plugin name>]",
                     ["permission"] = ""
                }
            }
        };
    }
    
    JavaScript:
    Code:
    OnHelp: function()
    {
        return {
            commands:
            {
                help:
               {
                    description: "Shows this help",
                    usage: "%s [<plugin name>]",
                   permission: ""
                }
            }
       };
    }
    
    Python:
    Code:
    def OnHelp( self ):
        return {
            "commands":
            {
                "help":
                {
                    "description": "Shows this help",
                    "usage": "%s [<plugin name>]",
                    "permission": ""
                }
            }
        }
    
     
    Last edited by a moderator: Aug 6, 2015
  11. Hi guys. Pls help. I installed this plugin, everything worked. Then I installed Rules plugin and Voteday plugin and server stopped showing mesagges. I dont know why. Which can be a problem? Can be some kInd of plugins conflict ? Or something else? HANX FOR HELP..
     
  12. Wulf

    Wulf Community Admin

    More that likely you did not edit your config right. Please upload the config here and I'll take a look at it.
     
  13. this config worked before...was edit like now ...same and without problem...and its all broadcast no only help text sorry for my mystake..
    Code:
    {
      "Messages":
      "Message2": "This server is 100% serious admins and take care about cheaters. Raiding is allowed without any exact rules ofc. no cheating. Ip ban is permanent :)",
      "Message1": "Join us on steam group Co-op Elite Gaming and talk with other players and admins of our server. Enjoy survival days",
      "Message3": "Use /help /loc /tphelp /who /players /remove /time /voteday",
      },
      "BroadCastInterval": 200,
      "ChatName": "Hello"
    }
     
  14. Wulf

    Wulf Community Admin

    You appear to be using the config for an autobroadcast plugin, not from this plugin.
     
  15. Your whole config isnt even a helptext config at all.
    See overview page for the default config, use that as a template to add your own messages.
     
  16. but problem ist that do not work all messages...broadcast, welcome message, nothing...only voteday message show up..before worked all..
     
  17. The config you posted isnt from this helptext plugin. You are probably mixing different plugins/configs.
    If the config you posted is called "helptext".json delete it and reload the plugin so it generates a new default one. You can then use this generated config as a template to edit it to your likings.
     
  18. ok. i try it.. thanx :)
     
  19. hello I am having trouble getting the Kits, ZLevels, and a few others to show up in the help text menu