All pastes #824169 Raw Edit

Mine

public text v1 · immutable
·published 2007-12-19 20:50 UTC
rendered paste body
In server.h, I added:
char			userinfobuffer[MAX_INFO_STRING];
int				nextReliableUserTime;
to client_s


In sv_main.c, I added:
SV_CheckClientUserinfoTimer();
to end of sv_frame


In sv_snapshot.c, I added:
void SV_CheckClientUserinfoTimer( void ) {
	int			i;
	client_t	*cl;
	char bigbuffer[ MAX_INFO_STRING * 2];

	for (i=0, cl = svs.clients ; i < sv_maxclients->integer ; i++, cl++) {
		if (!cl->state) {
			continue;		// not connected
		}
		if ( (sv_floodProtect->integer) &&  
			(svs.time >= cl->nextReliableUserTime)
			&& (cl->state >= CS_ACTIVE) &&
			(cl->userinfobuffer[0]!=0) ) 
		{
			//We have something in the buffer
			//and its time to process it
			sprintf(bigbuffer,"userinfo %s/0",cl->userinfobuffer);
			
			Cmd_TokenizeString(bigbuffer);
			SV_UpdateUserinfo_f(cl);
		}
	}
}
at the bottom.


And in sv_client.c, I changed SV_UpdateUserinfo_f to:
void SV_UpdateUserinfo_f( client_t *cl ) {
	if ( (sv_floodProtect->integer) && (cl->state >= CS_ACTIVE) && (svs.time < cl->nextReliableUserTime) ) {
		Q_strncpyz( cl->userinfobuffer, Cmd_Argv(1), sizeof(cl->userinfobuffer) );
		SV_SendServerCommand(cl, "print \"^7Command ^1delayed^7 due to sv_floodprotect.\"");
		return;
	}
	cl->userinfobuffer[0]=0;
	cl->nextReliableUserTime = svs.time + 4000;

	Q_strncpyz( cl->userinfo, Cmd_Argv(1), sizeof(cl->userinfo) );

	SV_UserinfoChanged( cl );
	// call prog code to allow overrides
	VM_Call( gvm, GAME_CLIENT_USERINFO_CHANGED, cl - svs.clients );
}

But for some reason, when updating userinfo from the userinfobuffer, it breaks after a space in the userinfo.