1. Okay so i want to make a plugin which will executes(every 2 mins) the command that is in the config file...

    It will be my first plugin so i need so much help
    With what should i start .. Timer ?
     
  2. Wulf

    Wulf Community Admin

  3. Wulf

    Wulf Community Admin

    Just take that and add some timers. ;)
     
  4. here is the problem i dont know how .. i must start from something easy to learn only if u could add the timers and BOLD or Underline the changes ..

    I have only this
    Code:
        Timers = {}
        self.Config.Interval = self.Config.Interval or 600
        self:SaveConfig()
    end
     
  5. Wulf

    Wulf Community Admin

    The only way to learn is to jump in! http://docs.oxidemod.org/#timers

    Just experiment. You can easily add timers without them being in the config, and then go from there as you learn.
     
  6. Okay now i think i'm gonna do this thanks for the info :))
     
  7. Wulf

    Wulf Community Admin

    Lua is one of the easier ones to me, which is where I got started with Oxide plugins. Before one year ago, I hadn't done anything with Lua.
     
  8. For now i've got this

    Code:
    PLUGIN.Title = "AutoExec"
    PLUGIN.Version = V(0, 0, 1)
    PLUGIN.Description = "Executes a command every (x) minutes."
    PLUGIN.Author = "Merka"
    PLUGIN.HasConfig = truefunction PLUGIN:Init()
        self:LoadDefaultConfig()
        command.AddChatCommand(self.Config.Settings.ChatCommand, self.Plugin, "cmdAutoCommand")
        command.AddConsoleCommand(self.Config.Settings.ConsoleCommand, self.Plugin, "ccmdAutoCommand")
    endtimer.Repeat(10, 0, function()
        rust.RunServerCommand(airdrop.massdrop 2)
    end, self.Plugin)
    i know that is something wrong with the "(airdrop.massdrop 2)"
     
  9. Wulf

    Wulf Community Admin

    I'd do something more like this (without config if you don't need it yet). Keep in mind that the airdrop command has to exist too. ;)
    Code:
    PLUGIN.Title = "AutoExec"
    PLUGIN.Version = V(0, 0, 1)
    PLUGIN.Description = "Executes a command every (x) minutes."
    PLUGIN.Author = "Merka"function PLUGIN:OnServerInitialized()
        self:TimedCommands()
    endfunction PLUGIN:TimedCommands()
        timer.Repeat(10, 0, function()
            rust.RunServerCommand("airdrop.massdrop 2")
        end, self.Plugin)
    end
    
     
  10. The plugin actualy works.. the problem is the Config .. i cant handle it..

    I want the config to have "Timer":"x" and "TimedCommands":"...."

    here is my plugin
    Code:
    PLUGIN.Title = "AutoExec"
    PLUGIN.Version = V(0, 0, 1)
    PLUGIN.Description = "Executes a command every (x) minutes."
    PLUGIN.Author = "Merka"
    PLUGIN.HasConfig = truefunction PLUGIN:LoadDefaultConfig()
        self.Config.ShowTimedCommands = self.Config.ShowTimedCommands or "true"
        self.Config.TimedCommands = self.Config.TimedCommands or {}
        self.Config.TimedCommands.TimedCommands = self.Config.TimedCommands.TimedCommands or "server.save"
        self:SaveConfig()
    endfunction PLUGIN:OnServerInitialized()
        self:TimedCommands()
    endfunction PLUGIN:TimedCommands()
        timer.Repeat(5, 0, function()
            rust.RunServerCommand("airdrop.massdrop 2")
        end, self.Plugin)
    end