This is just a little snippet from our server DLL at Trinity Entertianment coded by Lumanaris(PenguinGuy) and myself
This little snippet was originally by him but re-written recently by myself, you can toss this in with your servers dll as it's a far better way to block words rather than abuse.txt.
I just realized that this snippet also sends a message from the server to the client via MMatchServer::GetInstance()->Announce this isn't needed you can remove it from the source if you don't have the strut and addy of this function in your server DLL it will still block the word without it.
Struct;
Addy(Oct08);Code:void OnChannelChat (MUID *uidPlayer, MUID *uidChannel, char *szMessage) { ((void (__thiscall *) (LPVOID, MUID *, MUID *, char *))MMatchServer__OnChannelChatAddress) (this, uidPlayer, uidChannel, szMessage); } static MMatchServer *GetInstance () { return ((MMatchServer *(__cdecl *)())MMatchServer__GetInstanceAddress) (); } MMatchObject *GetObjectA (MUID *uidPlayer) { return ((MMatchObject *(__thiscall *) (LPVOID, MUID *))MMatchServer__GetObjectAAdress) (this, uidPlayer); }
main;Code:CONST uint32_t MMatchServer__OnChannelChatAddress = 0x004729C0; CONST uint32_t MMatchServer__GetInstanceAddress = 0x0041E640; CONST uint32_t MMatchServer__GetObjectAAdress = 0x00420960;
Code:CDetour MMatchServerOnChannelChatDet; void WINAPI MMatchServerOnChannelChatHook( MUID* uidPlayer, MUID* uidChannel, char* szMessage ) { MMatchObject* Object = MMatchServer::GetInstance()->GetObjectA( uidPlayer ); if( !Object ) return; char* szBlockedWords[] = { "words", "are", "sperated", "like", "so", }; char szStrCopy[1024]; strcpy( szStrCopy, szMessage ); _strlwr( szStrCopy ); for( int i = 0; i != sizeof( szBlockedWords ) / sizeof(char*); i++ ) { if( strstr( szMessage, szBlockedWords[i] ) ) { char szBuffer[1024]; sprintf_s( szBuffer, "[Server] : You can't say the word \'%s\'", szBlockedWords[i] ); MMatchServer::GetInstance()->Announce( uidPlayer, szBuffer ); return; } }
I don't think many of you will have a use for this, but for the people that do it should work just fine for you as you will know how to properly implement it =p
edit; OH I should mention this is only for channel chat. You'd have to edit it and change it up for the structs of chatroom chat etc.



Reply With Quote


