Просмотр полной версии : SAMPFUNCS get chat message
is there any way to get chat message before it will written to the chat log using c++?
BlackKnigga
28.07.2017, 18:48
is there any way to get chat message before it will written to the chat log using c++?
Raknet hook
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?
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
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
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
)
;
}
}
vBulletin® v3.8.14, Copyright ©2000-2026, vBulletin Solutions, Inc. Перевод: zCarot