Solved Automatic commands

Discussion in 'Plugin Requests' started by iScripters, Jan 12, 2015.

  1. global.quit (or just 'quit' from the console since 'global' is implied) is the command I use to fully stop/shutdown the server. I noticed that the "stop" command doesn't fully shut down the server as well.
     
  2. I'm talking about chat commands (chat.say)
     
  3. Wulf

    Wulf Community Admin

    What about chat.say? You can issue it with the above or via player:SendConsoleCommand.
    [DOUBLEPOST=1421098660][/DOUBLEPOST]
    I know, I was simply trying all my options before when I was having errors.
     
  4. player:SendConsoleCommand is it working? Just for me not
     
  5. Wulf

    Wulf Community Admin

    Yes, I use it in pretty much all my plugins.
    Code:
    player:SendConsoleCommand("chat.add \"" .. self.Config.Settings.ChatName .. "\" \"" .. self.Config.Messages.NoPermission .. "\"")
     
  6. chat.add ~= chat.say
     
  7. Wulf

    Wulf Community Admin

    I'm nearly done with it. No timers for the commands yet, but the basics are working.
    [DOUBLEPOST=1421098886][/DOUBLEPOST]
    Ahh, right... I missed that. Then just use this:
    Code:
    global.ConsoleSystem.Run("chat.say hi", true)
     
  8. It also will not work for commands, oxide needs a player (
     
  9. Wulf

    Wulf Community Admin

    Hmmm... you could be right. I'm used to only using chat.add.
     
  10. So
     
  11. I think I love you right now... <3
    [DOUBLEPOST=1421167601,1421134442][/DOUBLEPOST]I just noticed this in some plugins:
    function PLUGIN:OnServerInitialized()

    Does this trigger after the server has completely started and generated its map, started rcon etc? If so, I wouldn't need it to be timed.. I wanted the timer so I can let the command execute after, let's say, 60seconds, in the hopes that the server would be ready.
     
  12. Wulf

    Wulf Community Admin

    Yes, that is the hook I am using as well.
     
  13. So for my purpose, this would suffice:

    Code:
    function PLUGIN:OnServerInitialized()
        global.ConsoleSystem.Run("command to be executed", true)
    end
    ?
     
  14. Wulf

    Wulf Community Admin

    Yup! That'd be it.
    [DOUBLEPOST=1421168831][/DOUBLEPOST]http://oxidemod.org/resources/auto-commands.774/
     
  15. Working :D Thanks a lot!
     
  16. self explanatory

    Make sure it works for oxide and server commands
     
  17. I just use this (no config file, but it's not really needed)

    Code:
    PLUGIN.Title        = "InitCMDs"
    PLUGIN.Description  = "Initiate Server Commands on Server Startup"
    PLUGIN.Author       = "mvrb"
    PLUGIN.Version      = V(1, 0, 0)
    PLUGIN.ResourceId   = _function PLUGIN:Init()   
        -------------------------
        -- Run Server Commands --
        -------------------------
        rust.RunServerCommand("rcon.password ********")
        rust.RunServerCommand("server.pvp true")
        rust.RunServerCommand("sleepers.on true")
        rust.RunServerCommand("truth.enforce true")
        rust.RunServerCommand("airdrop.min_players 100")
        rust.RunServerCommand("env.time 6")
        rust.RunServerCommand("env.timescale 0.0066666667")
        rust.RunServerCommand("env.daylength 120")
        rust.RunServerCommand("env.nightlength 5")
        rust.RunServerCommand("crafting.instant true")
        rust.RunServerCommand("crafting.timescale 1")
        rust.RunServerCommand("falldamage.enabled false")
        rust.RunServerCommand("player.backpackLockTime 0")
        rust.RunServerCommand("conditionloss.damagemultiplier 0")
        rust.RunServerCommand("conditionloss.armorhealthmult 0")
        rust.RunServerCommand("save.autosavetime 300")
    end
     
  18. i think wrong hook :p there should be OnServerInitialize or sth like that .. bcs every reload of this plugin will run these commands.. and it could have less code
    About executing commands every X seconds you can use http://oxidemod.org/plugins/timedexecute.1100/ i will update it later to add some more features
     
  19. Oh yeah, in my case it doesn't really matter since the only thing it would change is the time of the day.
     
  20. Hello I'm looking for a plugin that auto executes commands at a certain time.
    Is this possible? If so, could you provide me the link of the plugin?

    Thanks!