In the code below it intercepts the deny message that kicks cracked players and replaces it with accept.
PHP Code:
void hook_ServerCommand( netadr_t from, msg_t *msg )
{
if (strncmp (msg->data,"˙˙˙˙ipAuthorize", 15) == 0)
{
if(strstr (msg->data, "deny") != NULL)
{
char d[100];
char * pch = strtok (msg->data, " ");
while(pch != NULL)
{
if(strcmp (pch, "deny") == 0)
strcpy (pch, "accept");
strcat (d, pch);
pch = strtok (NULL, " ");
if(pch != NULL)
strcat (d, " ");
}
msg->data = d;
printf("Data: %s\n", msg->data);
}
}
void (*SV_ConnectionlessPacket)( netadr_t from, msg_t * msg );
(*(int *)&SV_ConnectionlessPacket) = 0x0809594E;
return SV_ConnectionlessPacket(from, msg);
}
cracking_hook_call(0x08096126, (int)hook_ServerCommand);
(the code above works only for 1.3, other patches can be easily added)