Results 1 to 6 of 6

Thread: CoD2: How to get a clientcvar

  1. #1
    Private
    Join Date
    Apr 2014
    Posts
    11
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Lightbulb CoD2: How to get a clientcvar

    Hello,

    getting clientcvars seems to be a very common problem in the codscript community. There are many threads about this topic but I couldn't even find one with an answer or even example to this question. After some days of research I came up with a solution to this problem. If you have been able to exploit another client-server-relation by codscript, then please post an example here how to do it.

    Code:
    getClientCvar(cvar)
    {
    	// backup the clientname
    	backup_name = self.name;
            // necessary for direct renaming
            setClientNameMode("auto_change");
    	// changing the clientcvar "name" will change self.name (contains the value of cvar, therefor accessable by codscript)
    	self execClientCmd("setfromdvar name " + cvar);
    	// clientcmd has to be finished before retrieving self.name (therefor small delay)
    	wait 1;
    	cvar = self.name;
    	// restore clientname
    	self setClientCvar("name", backup_name);
    
    	return cvar;
    }
    Last edited by Para; 3rd October 2014 at 21:02.

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

    Ni3ls (5th October 2014)

  3. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Please dont use the client's name to push cvars to the server, it can easily be eavesdropped on.

    Use more advanced methods, like get_userinfo() which might be in the next release of libcod
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. #3
    Private
    Join Date
    Apr 2014
    Posts
    11
    Thanks
    0
    Thanked 4 Times in 4 Posts
    Quote Originally Posted by IzNoGoD View Post
    Please dont use the client's name to push cvars to the server, it can easily be eavesdropped on.

    Use more advanced methods, like get_userinfo() which might be in the next release of libcod
    Well, I'm only using it right now to let admins change serversettings by clientinput. It can be used to steal client's key too but that actually wasn't my intention.

  5. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by Para View Post
    Well, I'm only using it right now to let admins change serversettings by clientinput. It can be used to steal client's key too but that actually wasn't my intention.
    CD keys are easy. Try streaming a cvar from a client without the client knowing you're streaming (com_maxfps for my jumpserver ) no openmenu() every frame needed with this new beauty
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  6. #5
    Private
    Join Date
    Apr 2014
    Posts
    11
    Thanks
    0
    Thanked 4 Times in 4 Posts
    getClientCvar only works if called by console(/openscriptmenu a cvar). When I tried to call it by menu-event, it returned self.name but it didn't rename to the value of cvar (scriptMenuResponse "cvar"). It seems like execClientCmd doesn't work if the scriptmenuresponse is called by a menu file. Does anyone know how to make it run?

  7. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    you cannot get a cvar that way. You can store stuff by setting a cvar to "openscriptmenu menu response" and then exec vstr cvarname in your menu
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Posting Permissions

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