Commands in Dedicated Server chat

Discussion in 'Plugins' started by Jeferson Richart, Jan 18, 2023.

  1. Jeferson Richart

    Jeferson Richart Registered

    Joined:
    Oct 23, 2013
    Messages:
    174
    Likes Received:
    34
    I'm trying to build a server plugin that restarts the weekend by itself, when for example, the session advances to qualy, thus returning to practice.

    My idea would be to use the chat by sending the message "/callvote restartweekend" or "/callvote nextrace".
    But to my surprise, this command only works in the in-game chat. In dedicated server chat, this command does not work. Maybe because the dedicated server has this function in buttons that just click?
    The "/callvote nextsession" command works both in-game chat and on the dedicated server.

    Does anyone know if exists any other commands to restart the weekend on the dedicated server?
     
  2. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,008
    Likes Received:
    2,875
    Do you know THIS List? ;)
     
  3. Lazza

    Lazza Registered

    Joined:
    Oct 5, 2010
    Messages:
    12,382
    Likes Received:
    6,600
    When I've done server control I've "pressed" the server dialog buttons via the program/plugin. Easy enough to find the window (even multiple, identified by path and/or name) and the button IDs haven't changed in 15 years...
     
  4. Jeferson Richart

    Jeferson Richart Registered

    Joined:
    Oct 23, 2013
    Messages:
    174
    Likes Received:
    34
    Yes. As I said above, the restartweekend and nextrace commands contained in this list do not work if used on the dedicated server. It only works if you are a client and use the in-game chat.
     
  5. Jeferson Richart

    Jeferson Richart Registered

    Joined:
    Oct 23, 2013
    Messages:
    174
    Likes Received:
    34
    How boring is that. It would be much simpler for the internal command that already exists to work on the server.
     
  6. DanRZ

    DanRZ Registered

    Joined:
    Aug 22, 2021
    Messages:
    720
    Likes Received:
    220
    Maybe make a plugin that crashes the server when going out practice. Make sure the dedicated is in auto-restart and you're done ...

    Very brutal way to do it but it should work :D

    We definitely need more commands that can be called in plugins ... editgrid, setmass work pretty well via chat inside a plugin. Welcome Plugin is a good example for that kind of actions.
     
    Jeferson Richart likes this.
  7. Coutie

    Coutie Moderator Staff Member

    Joined:
    Oct 5, 2010
    Messages:
    3,782
    Likes Received:
    2,242
    I'll make a bug report about that.
    Edit: Actually, I don't know if it's a bug, I don't think admins are allowed to start votes. Normally when an admin is logged in, users are not allowed to start votes either, unless you change the server settings.
    Edit 2: Nevermind, I was wrong, I've made a bug report for it.
     
    Last edited: Jan 19, 2023
    Jeferson Richart and redapg like this.
  8. TheTrackAVL

    TheTrackAVL Registered

    Joined:
    Jan 17, 2021
    Messages:
    24
    Likes Received:
    7
    As an alternative to the plugin interface, you can use the rest API. If you get
    http://ip:port/navigation/state where ip is the IP address of the dedi and port is the WebUi port as defined in Player.json on the dedi, you'll get a return similar to:


    Code:
    {
      "state": {
        "internalStateCode": "OP_IN_OPTIONS",
        "navigationState": "NAV_MAIN_MENU",
        "settingMode": "SETTING_MULTIPLAYER",
        "user": {
          "admin": false,
          "userState": "DEFAULT"
        },
        "gameState": "GSTATE_DYN",
        "gameSession": "QUALIFY1",
        "gamePhase": "GREEN",
        "appBuild": 1131
      }
    }
    based on the 'gameSession' value, you can see the current session type.

    You can then post to http://ip:port/navigation/action/{navAction} where navAction is NAV_FINISH_SESSION or NAV_RESTART_WEEKEND or NAV_EXIT.

    Check out http://ip:port/swagger/index.html for more info.
     
  9. Jeferson Richart

    Jeferson Richart Registered

    Joined:
    Oct 23, 2013
    Messages:
    174
    Likes Received:
    34
    Ok, I know we have palliative options. But the command running directly within the code is the cleanest and simplest way to use it. If we can use other commands like \restartwarmup directly inside the plugin, using the other existing commands via chat should not be a problem.

    Anyway, thanks for the tip.
     

Share This Page