View Single Post
Old 08-24-2009, 01:55 AM   #3
-=*Raz0r*=-'s Avatar
Join Date: Oct 2006
Location: Australia
Posts: 243
Create a new string in client->sess called IP

Upon ClientConnect it does a userinfo grab for the IP.
Create a local variable (char TmpIP[32] = {0})

Adjust the code to look like:
	// check to see if they are on the banned IP list
	value = Info_ValueForKey (userinfo, "ip");
	//Store the IP
	if (!isBot)
		Q_strncpyz(TmpIP, value, sizeof(TmpIP)); // Used later
	if ( G_FilterPacket( value ) ) {
		return "Banned";
Then, just before this block of code:
//if this is the first time then auto-assign a desired siege team and show briefing for that team
Chuck in...
if (firstTime && !isBot)
	{// No IP sent when connecting, probably an unban hack attempt
		client->pers.connected = CON_DISCONNECTED;
		return "Invalid userinfo detected";
	Q_strncpyz(client->sess.IP, TmpIP, sizeof(client->sess.IP));
So when someone connects for the first time, their IP is stored in client->sess.IP, which can then be accessed from anywhere in the gameside code.
That code there (As explained in comments) will also deny connection from someone attempting to overflow their userinfo string, in which case ban checks can't be performed

Then, create your file writing/reading funcs using that.
For file reading, I recommend poking around JA's token parsing system (You know, the way it reads .sab files)

Sorry I can't post much more, kind-of rushed =P

Last edited by -=*Raz0r*=-; 10-02-2009 at 08:48 PM. Reason: Forgot to add '!isBot' where we deny the connection
-=*Raz0r*=- is offline   you may: quote & reply,