Block Text Snippet

Results 1 to 7 of 7
  1. #1
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Block Text Snippet

    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;

    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);
        }
    Addy(Oct08);

    Code:
    CONST uint32_t MMatchServer__OnChannelChatAddress = 0x004729C0;
    CONST uint32_t MMatchServer__GetInstanceAddress = 0x0041E640;
    CONST uint32_t MMatchServer__GetObjectAAdress = 0x00420960;
    main;

    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.
    Last edited by Dawson; 05-12-10 at 11:52 PM.


  2. #2
    Doggie And Rice. Military is offline
    MemberRank
    Jun 2009 Join Date
    Here and AboutLocation
    3,301Posts

    Re: Block Text Snippet

    I haven't seen Travis in a while...nice release.

  3. #3
    I am THE DON Joe9099 is offline
    MemberRank
    Jan 2007 Join Date
    England, UkLocation
    3,655Posts

    Re: Block Text Snippet

    Good stuff, abuse.txt was completely useless anyways lawl, but heh good job.

  4. #4
    Banned RevolutioN is offline
    BannedRank
    Jun 2010 Join Date
    United KingdomLocation
    440Posts

    Re: Block Text Snippet

    Thanks, pretty cool Snippet.

  5. #5
    Ā  Phoenix is offline
    ModeratorRank
    Mar 2009 Join Date
    6,890Posts

    Re: Block Text Snippet

    We could use special characters for character names on July 2008 files with ease, using GUNZ2830's edit to enable all symbols and by using your DLL to block stuff like spaces, ^, etc. Could you write one for character / clan names?

  6. #6
    igunz.net Dawson is offline
    LegendRank
    Feb 2010 Join Date
    ::1 (Canada BC)Location
    2,581Posts

    Re: Block Text Snippet

    Quote Originally Posted by llMafiall View Post
    Dawson, does penguin still develops for gunz?
    He encountered a lot of IRL issues and his last work has been at Trinity, he still develops but he doesn't have the time or means to do so in his current situation.

  7. #7
    Retired. Don't PM. SecretsOThePast is offline
    DeveloperRank
    Jan 2009 Join Date
    643Posts

    Re: Block Text Snippet

    Quote Originally Posted by Phoenix View Post
    We could use special characters for character names on July 2008 files with ease, using GUNZ2830's edit to enable all symbols and by using your DLL to block stuff like spaces, ^, etc. Could you write one for character / clan names?



    Code:
    CDetour MMatchServerResponseCreateCharDet;
    void WINAPI MMatchServerResponseCreateCharHook( MUID* uidPlayer, const int nCharIndex, const char* szName, int nSex, const unsigtned int nHair, const unsigned int nFace, const unsigned int nCostume  )
    {
    
    char* szBlockedWords[] = { "^", " " };
    char szStrCopy[1024];
    strcpy( szStrCopy, szName );
    _strlwr( szStrCopy );
    
    for( int i = 0; i != sizeof( szBlockedWords ) / sizeof(char*); i++)
    	{
    		if( strstr( szMessage, szBlockedWords[i] ) )
    		{
                            return 0;
    
                    }
            }
    
    
    
    }
    I literally pseudocoded this in less than 2 minutes, but if you want to try it, the address in 07 files is 0x0044FB70 for MMatchServer::ResponseCreateChar, you can find it in 08 by xreferencing the opcode ID for CreateChar



Advertisement