Results 1 to 4 of 4

Thread: Console script

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

    Console script

    how to make a script that runs a cmd on the console? Like rcon map_restart

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

    kung foo man (27th April 2021)

  3. #2
    Corporal voron00's Avatar
    Join Date
    Nov 2014
    Posts
    248
    Thanks
    64
    Thanked 216 Times in 116 Posts
    Cmds like map_restart are static and can only be added through engine itself.
    But you can edit libcod and add your own cmds there by using Cmd_AddCommand

    https://github.com/voron00/libcod/bl...r/bsp.cpp#L167


    PHP Code:
    void my_function()
    {
        
    printf("test\n");
    }


    Cmd_AddCommand("my_cmd_name"my_function); 
    sudo apt-get rekt

  4. The Following User Says Thank You to voron00 For This Useful Post:

    kung foo man (27th April 2021)

  5. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,661
    Thanks
    17
    Thanked 1,004 Times in 630 Posts
    I think he's asking to add like /rcon yourmom to do a thing.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (27th April 2021)

  7. #4
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    644
    Thanks
    203
    Thanked 440 Times in 297 Posts
    You can do this via GSC scripts:

    With libcod:
    https://killtube.org/showthread.php?3153-callback-RCON

    Without libcod:
    PHP Code:
    level endon("intermission");
    setCvar("customcommand1"""); // can be set via rcon as: /rcon customcommand1 value instead of /rcon set customcommand1 value

    for (;;)
    {
        if (
    getCvar("customcommand1") != "") {
            
    setCvar("customcommand1""");
            
    customcommand1(); 
        }

        
    wait 0.05;
    }

    customcommand1()
    {


  8. The Following User Says Thank You to Mitch For This Useful Post:

    kung foo man (27th April 2021)

Posting Permissions

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