I am currently trying this:
PHP Code:
void hook_ServerCommand( netadr_t from, msg_t *msg )
{
if (strncmp (msg->data,"\xff\xff\xff\xffipAuthorize", 15) == 0)
{
char * pch = strstr (msg->data, "deny");
if(pch != NULL)
{
strncpy (pch,"demo",4); // replace 'deny' with 'demo' (now you need to set fs_restrict in cod to allow the deny players)
printf("%s\n", msg->data);
}
}
void (*SV_ConnectionlessPacket)( netadr_t from, msg_t * msg );
(*(int *)&SV_ConnectionlessPacket) = hook_ConnectionlessPacket;
return SV_ConnectionlessPacket(from, msg);
}
https://github.com/M-itch/libcod/com...975ae48d8d4db8
From quake source code:
PHP Code:
if ( !Q_stricmp( s, "demo" ) ) {
if ( Cvar_VariableValue( "fs_restrict" ) ) {
// a demo client connecting to a demo server
NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr,
"challengeResponse %i", svs.challenges[i].challenge );
return;
}
// they are a demo client trying to connect to a real server
NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr, "print\nServer is not a demo server\n" );
// clear the challenge record so it won't timeout and let them through
Com_Memset( &svs.challenges[i], 0, sizeof( svs.challenges[i] ) );
return;
}
if ( !Q_stricmp( s, "accept" ) ) {
NET_OutOfBandPrint( NS_SERVER, svs.challenges[i].adr,
"challengeResponse %i", svs.challenges[i].challenge );
return;
}
With fs_restrict 0
Now it replaces 'fs_restrict' with 'sv_cracked'.
https://github.com/M-itch/libcod/com...c7fb772f22acab
PHP Code:
char * cracked = (char *)"sv_cracked";
memcpy((void *)(fsrestrict_ServerCommand+3), &cracked, 4);
Check in the hook if sv_cracked is 1 and then replace deny with demo. (works in latest commit)
https://github.com/M-itch/libcod/com...b63807eaca66bf
(included support for 1.0 and 1.2)
New binaries are available at: http://znation.nl/libcod/