Results 1 to 9 of 9

Thread: cod2 get cvar from client

  1. #1
    ... connecting
    Join Date
    May 2019
    Posts
    7
    Thanks
    6
    Thanked 3 Times in 3 Posts

    cod2 get cvar from client

    Hi all,

    I'm trying to read some cvar on the client from the server.

    As of now i'm able to read the name thanks to get_userinfo( "name" ); but all other things give me an UNDEFINED why is that?

    My ultimate goal is to create custom cvar on the client and read them later.

  2. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    387
    Thanks
    74
    Thanked 90 Times in 76 Posts
    Quote Originally Posted by Miri View Post
    My ultimate goal is to create custom cvar on the client and read them later.
    WHAT FOR?)

    People so stupidly disguise their fraudulent intentions...
    write shit code's

  3. #3
    Private First Class voron00's Avatar
    Join Date
    Nov 2014
    Posts
    233
    Thanks
    62
    Thanked 198 Times in 106 Posts
    It's possible, however with a little trick that code allows to get player's cd-key and proably shouldn't be posted here.
    sudo apt-get rekt

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

    Miri (22nd May 2019)

  5. #4
    ... connecting
    Join Date
    May 2019
    Posts
    7
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by maxdamage99 View Post
    WHAT FOR?)

    People so stupidly disguise their fraudulent intentions...
    Sorry I didn't explain it very well, no fraudulent intentions mate.

    Let's say I open a contest blue team vs red team and in 10 days I announce the winning team.
    Everyone can choose(and change later) a team and every kill gets +1 to the team you cheer for (doesn't matter if you allies or axis), so you set yourself a custom cvar team_name "red" or "blue", but the server has to be able to read this cvar in some way from client.
    For now i have done different working approach but i don't like them very much:
    - set the team you cheer for in your name; every kill read get_userinfo( "name" ); then parse if there is team name inside and give +1;
    - after connect write the team you cheer for in chat with some flag to make parsing easy, then associate team cheer with GetEntityNumber(); and track kills by that entity number, but you still need to parse every chat message.

    I wanted to do something like client add cvar team_name "color" in his autoexec.cfg so is set at game launch and can change it when he wants.

    In older posts it was only written that it can be done is some way but not how, that's why I'm asking.

    Quote Originally Posted by voron00 View Post
    It's possible, however with a little trick that code allows to get player's cd-key and proably shouldn't be posted here.
    There isn't some neutered function where I can read only that cvar without leaking player cd-keys?

    Or do you think I can execute it without a cvar but still make it already available on next connection?
    Last edited by Miri; 22nd May 2019 at 17:30.

  6. #5
    Private First Class voron00's Avatar
    Join Date
    Nov 2014
    Posts
    233
    Thanks
    62
    Thanked 198 Times in 106 Posts
    Your best option is to create a login system and store whatever data you want to associate with login in mysql/sqlite databases. https://killtube.org/showthread.php?...(persistently)
    sudo apt-get rekt

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

    Miri (22nd May 2019)

  8. #6
    ... connecting
    Join Date
    May 2019
    Posts
    7
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by voron00 View Post
    Your best option is to create a login system and store whatever data you want to associate with login in mysql/sqlite databases. https://killtube.org/showthread.php?...(persistently)
    I already read that thread but he said that it was still not secure at some point so i thought he never made it secure. I'll give it another read.

    As for mysql the client can't change team without being logged in the server, maybe with some external web interface just for that, I'll think about it.

    Thank you anyway.

  9. #7
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    387
    Thanks
    74
    Thanked 90 Times in 76 Posts
    Everything you want to do can be realized without "getcvar", voron00 is right: easiest way to make a user system (login/register)
    write shit code's

  10. #8
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,582
    Thanks
    17
    Thanked 931 Times in 580 Posts
    The system I wrote is not 100% secure, but nothing will be 100% secure, as cod doesnt support client-side crypto.

    For all normal intents and purposes the system is secure enough.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

    Sending me a private message makes me want to help you LESS.

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

    kung foo man (26th May 2019)

  12. #9
    ... connecting
    Join Date
    May 2019
    Posts
    7
    Thanks
    6
    Thanked 3 Times in 3 Posts
    After a bit of trial and error the system works great! I just need some little QoL changes like a nice HUD and it's pretty much done!

    If I have new questions can I post them here o should I create a new thread?

  13. The Following User Says Thank You to Miri For This Useful Post:

    kung foo man (27th May 2019)

Posting Permissions

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