ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   SAMPFUNCS get chat message (https://forum.antichat.xyz/showthread.php?t=1317832)

seek1 28.07.2017 18:31

is there any way to get chat message before it will written to the chat log using c++?

BlackKnigga 28.07.2017 18:48

Цитата:

Сообщение от seek1

is there any way to get chat message before it will written to the chat log using c++?

Raknet hook

seek1 28.07.2017 18:56

you mean using RakNetScriptHookType::RAKHOOK_TYPE_INCOMING_RPC?

if it's what you mean!, i have tried it but it's not working as expected for example

Цитата:


[15:09:17] Объявление: Продам уютный домик на горе « Vinewood ». Прислал: Alessandro_Almonte. Тел: 595959

[15:09:17] Отредактировал сотрудник SF News: Enrique_Visconti


it only get the last line of message

BlackKnigga 28.07.2017 19:00

Because it's two differnent messages.

What u need?

seek1 28.07.2017 21:52

Цитата:

Сообщение от BlackKnigga

Because it's two differnent messages.
What u need?

I am working on a translation plugin and i used RakHook but i found that if there are two messages appear in the same time , i only get the last line.. that's why i was asking if there any different way to get the chat message... i hope you understand what i mean

BlackKnigga 28.07.2017 21:56

Цитата:

Сообщение от seek1

I am working on a translation plugin and i used RakHook but i found that if there are two messages appear in the same time , i only get the last line.. that's why i was asking if there any different way to get the chat message... i hope you understand what i mean

Code

seek1 29.07.2017 02:24

C++:





Код:

bool
CALLBACK
incomingRPC
(
stRakNetHookParams
*
params
)
{
if
(
params
->
packetId
==
ScriptRPCEnumeration
::
RPC_ScrClientMessage
)
{
if
(
translatorEnabled
)
{
DWORD color
;
DWORD strlen
;
char
string
[
2048
]
;
params
->
bitStream
->
ResetReadPointer
(
)
;
params
->
bitStream
->
Read
(
color
)
;
params
->
bitStream
->
Read
(
strlen
)
;
params
->
bitStream
->
Read
(
string
,
strlen
)
;
string
[
strlen
]
=
'\0'
;
//translation part should be here
AddMessageToChat
(
D3DCOLOR_XRGB
(
0
,
0XAA
,
0
)
,
"%s"
,
string
)
;
return
false
;
}
}
return
true
;
}
void
CALLBACK
mainloop
(
)
{
static
bool
init
=
false
;
if
(
!
init
)
{
init
=
true
;
SF
->
getRakNet
(
)
->
registerRakNetCallback
(
RakNetScriptHookType
::
RAKHOOK_TYPE_INCOMING_RPC
,
incomingRPC
)
;
}
}


seek1 30.07.2017 15:17

BlackKnigga, what's up ?


Время: 17:07