Chat Message

KillerZ

Well-Known Member
Joined
Apr 6, 2014
Messages
74
Likes
0
Points
6
5
#1
Is there a way to delete a message from chat? Doesn't matter if it's just for me (clientside). Like if I got a message saying:

"[server] You don't have permission to use *special command here*"

Would there be someway to remove that?
 

0x32789

Well-Known Member
Joined
May 26, 2014
Messages
762
Likes
1
Points
68
Location
teknickal suprot
#3
hook incoming rpcs, check if RPC is RPC_CHAT OR WHAtever I forgot, if it is that then read the rpc parameters, after reading check if the param contains "[server] you don't have permission to use" if it contains, use the raknet opcode hook return to false. at the end of the hook function, add the raknet opcode hook return to true .
 

supahdupahnubah

Well-Known Member
Joined
Dec 31, 2015
Messages
679
Likes
3
Points
33
#4
Monkey-code and easiest way if you can't afford that information 0x32789 wrote xD :

If you don't know how to work with addresses etc, take a look at this 0.3x AUTOIT chat translator http://forum.sa-mp.com/showthread.php?t=479769
Of course addresses have changed so you have to figure out what address remains for last chat message or what address contains chat array
1. Create a thread that scans last chat message for.. like.. each 50 or 100 ms?
2. Once there's a message you have to replace\delete get it's address
3. Profit! You can now edit\replace to null this string
 

0x32789

Well-Known Member
Joined
May 26, 2014
Messages
762
Likes
1
Points
68
Location
teknickal suprot
#5
supahdupahnubah said:
Monkey-code and easiest way if you can't afford that information 0x32789 wrote xD  :

If you don't know how to work with addresses etc, take a look at this 0.3x AUTOIT chat translator http://forum.sa-mp.com/showthread.php?t=479769
Of course addresses have changed so you have to figure out what address remains for last chat message or what address contains chat array
1. Create a thread that scans last chat message for.. like.. each 50 or 100 ms?
2. Once there's a message you have to replace\delete get it's address
3. Profit! You can now edit\replace to null this string
I don't think that he might be able to do it..
plus that AUTOIT chat translator is messy, He didn't gave explaination for code and it will be hard for him.
You can make your own and it can be done in a even cleaner way by taking advantage of incoming RPC_Chat packets, Hook 'em, then launch a thread and then start translating it in that thread so it dosent freeze your app or .sf plugin and get the result and voila, here is it..
I was playing and searching net on how to download files using WinInet in MS C++.. I found a tutorial edited it(you can say, I c&p) and some tweaks(removing unused code) and now it can read online text.
Google translate works but the problem here is IDK why it sometimes give me some request problem and dosent let me pass through..
Take a look at this code (my c++ code)
Code:
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <windows.h>
#include <tlhelp32.h>
#include <iomanip>
#include <TlHelp32.h> 
#include <comdef.h>
#include <tchar.h>
#include <WinInet.h>
#include <ctype.h>
#include <string>
#include <algorithm>

#pragma comment(lib, "WinInet.lib")

using namespace std ;

char TranslateToLangCode [ 6 ] = { 0 };
char TranslateFromLangCode [ 6 ] = { 0 };

std::string failed(const char* what)
{
char buffer[128];
sprintf_s(buffer, 128, "%s failed", what);
std::string failedStr = buff;
return failedStr;
}

std::string NetRead(const char* szUrl)
{
int result;

HINTERNET hInternet;

result = 0;
hInternet = InternetOpen (_T("imaged"),
INTERNET_OPEN_TYPE_DIRECT,  //__in  DWORD dwAccessType
NULL,                       //__in  LPCTSTR lpszProxyName,
NULL,                       //__in  LPCTSTR lpszProxyBypass,
NULL                        //_in   DWORD dwFlags
);

DWORD dwSize;
TCHAR szHead[15];
BYTE szTemp[1024];
HINTERNET  hConnect;

szHead[0] = '\0';
std::string output = "";
if ( !(hConnect = InternetOpenUrl( hInternet, szUrl, szHead, 15, INTERNET_FLAG_DONT_CACHE, 0)))
{
return failed("InternetOpenUrl");
}
do
{
if (!InternetReadFile (hConnect, szTemp, 1024,  &dwSize) )
{
return failed("InternetReadFile");
}
if (!dwSize)
break;
else
output.append((const char*)szTemp);

} while (true);

int i, j;
for(i=0; output[i]!='\0'; i++)
{
while ( ! (  ( output[i] >= 'a' && output[i] <= 'z') || (output[i] >= 'A' && output[i] <= 'Z' || output[i] == '\0' || output[i] == ' ' ) ) )
{
for(j=i;output[j]!='\0';++j)
{
output[j]=output[j+1];
}
output[j]='\0';
}
}

InternetCloseHandle(hInternet);
return output;
}

int main ( )
{
SetConsoleTitle ( "Translator X3-R" ) ;
Sleep ( 500 ) ;
char input[512] = { 0 };
char inss[512] = { 0 };
sprintf_s(TranslateToLangCode, 6, "es");
sprintf_s(TranslateFromLangCode, 6, "en");
while ( true )
{
if (GetAsyncKeyState(VK_UP))
{
Sleep(1000);
std::cout << "Type the thing you want to translate:" << endl;
cin.getline(input, 512);
sprintf_s(inss, 512, "http://translate.google.com/translate_a/t?client=p&text=%s&sl=%s&tl=%s&ie=UTF-8&oe=UTF-8&multires=0", input, TranslateFromLangCode, TranslateToLangCode);
std::string out = NetRead(inss);
std::cout << out << endl;
Sleep(1000);
}
if (GetAsyncKeyState(VK_DOWN))
{
Sleep(1000);
std::cout << "Type the language code you wish to translate from:" << endl;
cin.getline(TranslateFromLangCode, 6);
std::cout << "Language to Translate from code is now: " << TranslateFromLangCode << endl;
std::cout << "Type the language code you wish to translate to:" << endl;
cin.getline(TranslateToLangCode, 6);
std::cout << "Language to Translate to code is now: " << TranslateToLangCode << endl;
Sleep(1000);
}
}

return 0 ;
}
 
OP
OP
K

KillerZ

Well-Known Member
Joined
Apr 6, 2014
Messages
74
Likes
0
Points
6
5
#6
I did it like this, I didn't know how to check if the text was "[server] you dont have permission to use" but with [email protected] I was able to get some number and I checked if that number came up. If the message came in it disabled clientmessage. It's pretty noob code, but hey, it worked! I was able to disable the message. If you think there are ways to make it better leave a comment.

Code:
{$CLEO}
{$INCLUDE SF}
 
0001: wait 0 ms
 
while not SAMP.Available()
    wait 400
end
 
0BE3: raknet setup_incoming_rpc_hook @in_rpc
 
0BDE: pause_thread 0 
 
:in_rpc
0BE5: raknet [email protected] = get_hook_param PARAM_PACKETID 
if
    [email protected] == RPC_SCRCLIENTMESSAGE   
then
    0BE5: raknet [email protected] = get_hook_param PARAM_BITSTREAM   
 
    if 
        [email protected] == RPC_SCRCLIENTMESSAGE
    then
        0BE7: raknet [email protected] = bit_stream_read [email protected] type BS_TYPE_SHORT 
        0BE7: raknet [email protected] = bit_stream_read [email protected] type BS_TYPE_INT 
        0BE7: raknet [email protected] = bit_stream_read [email protected] type BS_TYPE_BYTE 
        0BE7: raknet [email protected] = bit_stream_read [email protected] type BS_TYPE_BYTE
        if
            0039:   [email protected] == 4325375
        then  
            0BE0: raknet hook_ret false
        else
            0BE0: raknet hook_ret true 
        end
    end
end
0BE0: raknet hook_ret true
 
Top