Info_ValueForKey(


(MrPingu) #1

I dont get this. I’ve added this to ClientuserInfoChanged in g_client.c


	// check for warpers
	s = Info_ValueForKey( userinfo, "rate" );
	if ( atoi(s) < 3000 || atoi(s) > 25000) trap_DropClient(ent->client->ps.clientNum, "rate must be between 3000 and 25000");

	s = Info_ValueForKey( userinfo, "cl_timenudge" );
	if ( atoi(s) < -50 || atoi(s) > 0) trap_DropClient(ent->client->ps.clientNum, "cl_timenudge must be between -50 and 0");

	s = Info_ValueForKey( userinfo, "cl_maxpackets" );
	if ( atoi(s) < 30 || atoi(s) > 100) trap_DropClient(ent->client->ps.clientNum, "cl_maxpackets must be between 30 and 100");

And I’m getting kicked by server for not having cl_maxpackets between 30 and 100 even when I’m sure it is. (I tested with cl_maxpackets 40)

I’ve figured out that this command does not return a string:
Info_ValueForKey( userinfo, “cl_maxpackets” );

Do you have any idea what I should do to restrict players having a wrong value of cl_maxpackets?

MrPingu, rtcwdemo modder


(MrPingu) #2

yeh, I’m getting kiced with the other cvarrestrictioncommands when the cvars are outside the allowed amount.


(SCDS_reyalP) #3

Well, if I had this problem, I’d G_Printf s and atoi(s). Maybe the whole userinfo string too.

cl_timenudge and cl_maxpackets are not sent by default in RTCW, if I remember right. OSP and ET do send them. If you are doing this for rtcwmain, you will have to add client code to send them. You can get this from the ET source (which itself came from OSP/RTCW).

That said, why not just use PB cvar restrictions ?

Finally, I’m pretty sure that the upper bounds on rate and cl_maxpackets are enforced by the engine anyway, as is the lower bound on cl_timenudge.


(MrPingu) #4

I’m currently modding rtcw demo, and it doesn’t have PB or clientside sources. So I need to do this serverside only.


(SCDS_reyalP) #5

Well then, you’re screwed :moo: ISTR the demo EULAs specifically forbid making mods for the demo, so don’t expect a lot of sympathy.

You could look into implementing some kind of antiwarp on the server, thus limiting the advantage of abusing net settings. There is some discussion tangential discussion of antwarp in these threads…
http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=7391&highlight=antiwarp
http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=7890&highlight=antiwarp

Of course you would want to look at the unlagged 2 source:
http://www.planetquake.com/alternatefire/

Needless to say, that’s a much more challenging project than some simple cvar checks.


(MrPingu) #6

Well then I’m screwd. tnx for you’re time :slight_smile: