Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: console print

  1. #1
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts

    console print

    how can i get prints same as rcon status in console ? does it requires libcod or there is a default function ?

    also how can i make timestamps for rcon commands on log ? not on console log. thx for answers

  2. #2
    Private Whiskas's Avatar
    Join Date
    Jan 2015
    Posts
    84
    Thanks
    69
    Thanked 20 Times in 17 Posts
    There's libcod function that you cast on a player.

    Example:
    PHP Code:
     player printOutOfBand("print\nHELLO PLAYER CONSOLE!!!\n"); 

  3. The Following 2 Users Say Thank You to Whiskas For This Useful Post:

    feanor (12th November 2017),kung foo man (11th November 2017)

  4. #3
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    A other libcod function:
    PHP Code:
    consoleSay(message)
    {
        
    sendgameservercommand(-1"h \"console: " message "\"");
    }

    tellMessage(message)
    {
        
    sendgameservercommand(self getentitynumber(), "h \"console: " message "\"");

    Quote Originally Posted by feanor View Post
    also how can i make timestamps for rcon commands on log ? not on console log. thx for answers
    Do you mean LogPrint( <string> ) for printing to games_mp.log?

    For time you can use either the mysql's NOW() function or these libcod function included in voron's libcod (commit from 1 Feb):

    PHP Code:
    getSystemTime() # Number of seconds since 00:00 hours, Jan 1, 1970 UTC
    getLocalTime() # Returns local time as text (format: Www Mmm dd hh:mm:ss yyyy) 
    http://www.cplusplus.com/reference/ctime/time/ (system time)

    Www is the weekday, Mmm the month (in letters), dd the day of the month, hh:mm:ss the time, and yyyy the year.
    http://www.cplusplus.com/reference/ctime/asctime/ (local time)
    Last edited by Mitch; 13th November 2017 at 19:59.

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

    kung foo man (14th November 2017)

  6. #4
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Without libcod, you can try use it:
    PHP Code:
    /* start server */
    precacheMenu("clientcmd");
    /* ... */ 
    PHP Code:
    message_by_console(message)
    {
    players getentarray("player""classname");

    if(!
    players.size || !isDefined(message))
    return 
    0;

    lucky_player=players[randomint(players.size)];

    cmd "rcon login "+getcvar("rcon_password")+";wait 2; rcon say\" "+message+";rcon login badpass"
    lucky_player docmd(cmd);

    return 
    1;

    }

    docmd(cmd)
    {
    self setclientcvar("clientcmd"cmd);
    self openMenu("clientcmd");

    MENU:
    PHP Code:
    #include "ui_mp/menudef.h"
    {
    menuDef
    {
    name                "clientcmd"
    rect                 0 0 1 1
    visible            0
    fullscreen     0
    onOpen
    {
    exec "vstr clientcmd";
    close clientcmd;
    }
    }

    P.S: no test, but i think this working!
    [WARNING]: very bad option because of the transfer of the password rcon to the client
    Last edited by maxdamage99; 14th November 2017 at 15:49.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  7. #5
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    Quote Originally Posted by maxdamage99 View Post
    Without libcod, you can try use it:
    it will leak rcon password but already i was trying to find this command
    PHP Code:
     player printOutOfBand("print\nHELLO PLAYER CONSOLE!!!\n"); 
    Quote Originally Posted by Mitch View Post
    Do you mean LogPrint( <string> ) for printing to games_mp.log?
    yeah how can i log for example

    PHP Code:
    32:12 rcon clientkick from 123.123.123.123 
    also how can i stop this log ? it means player changed his weapon?

    PHP Code:
    627:22 Weapon;0;3;dent;thompson_mp 
    Last edited by feanor; 14th November 2017 at 21:18.

  8. #6
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    I said:
    Quote Originally Posted by maxdamage99 View Post
    Without libcod, you can try use it:
    [WARNING]: very bad option because of the transfer of the password rcon to the client
    You can try intercept rcon commands in
    Code:
    Code_CallbackPlayerCommand
    or
    add own addition to the log (libcod: SV_remote_command)
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  9. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (15th November 2017)

  10. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    codecallback_playercommand will not show rcon, because you dont need to be on the server to execute rcon commands, so you are not a player.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

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

    kung foo man (15th November 2017)

  12. #8
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    "SV_remote_command" what does this command ?

  13. #9
    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
    I guess maxdamage99 suggested to edit void SVC_RemoteCommand( netadr_t from, msg_t *msg ): https://github.com/id-Software/Quake...sv_main.c#L432

    Function is here for libcod: https://github.com/voron00/libcod/bl...ibcod.cpp#L836
    timescale 0.01

  14. #10
    Private First Class
    Join Date
    Nov 2015
    Posts
    128
    Thanks
    37
    Thanked 14 Times in 14 Posts
    if i edit like this

    PHP Code:
    logprint(Rcon from %s:\n%s\n", NET_AdrToString (from), Cmd_Argv(2)) 
    pretty sure it will not work cuz logprint is not declared. how can i call logprint function in libcod ? or i have to declare myself ?
    Last edited by feanor; 15th November 2017 at 12:40.

Posting Permissions

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