Results 1 to 2 of 2

Thread: Executing rcon commands by server - from a gsc file - without execclientcommand

  1. #1
    ... connecting
    Join Date
    Nov 2021
    Posts
    1
    Thanks
    0
    Thanked 1 Time in 1 Post

    Executing rcon commands by server - from a gsc file - without execclientcommand

    Hello cod2 experts! This is my first post here :-)

    My question is about how to execute rcon commands on server side?

    There are 3 possibilities currently for executing rcon commands:
    a) client side: logging in a player with "rcon login password" using the execclient command menu trick
    b) using 3rd part programs which send some message to website (i dont know how they work unfortately), for example hslw or any rcon bot ("sending" data to website with these data: ip, port, rcon login and action command

    c) and I would need the third option which is between these two: how can i execute an rcon command inside a gsc?

    Practical use: i would like to make a console message welcome script, which sends a message on playerconnect /or playerspawn function (at first spawn).

    I have this all working, with the client side rcon login method, but its a bad practice cause rcon password flows throw client variables (clientcmd cvar stores it temporarily, so the player can login into rcon.

    So it seems like there should be a solution between these two. 3rd party bots can solve this, so inside a gsc file it should also work based on my logic, cause this would be more simple than 3rd party bots.

    Do you have any idea?

    This is the article where Kungfooman mentioned something about a menu-less server side command:
    https://killtube.org/showthread.php?...to-the-clients

    I am a beginner at scripting, but would be awesome to solve this. Thank you very much for any kind of help, have a nice day :-)

    (the id for tell command is not hard coded in real example, i just wanted to simplify it)

    Code:
    	self setClientCvar("clientcmd", "rcon login pass; rcon tell 2 Welcome to the server " + self.name + "rcon logout");
    
    	self openMenuNoMouse(game["menu_clientcmd"]);
    	self closeMenu(game["menu_clientcmd"]);
    	wait 0.2;
    	self setClientCvar("clientcmd", "");
    	wait 0.2;

  2. The Following User Says Thank You to richard27 For This Useful Post:

    kung foo man (5th November 2021)

  3. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    If you don't want to use B3 or any other log-reader-send-rcon-third-party-tool this you can use libcod:

    https://github.com/kungfooman/libcod...r/gsc.cpp#L266

    Your example would be:

    Code:
    Cmd_ExecuteString("tell 2 Welcome to the server " + self.name);
    timescale 0.01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •