
09.10.2024, 21:56
|
|
Постоянный
Регистрация: 24.09.2020
Сообщений: 364
С нами:
2966237
Репутация:
148
|
|
Сообщение от nonelike
ща попробовал с твоим кодом, ваще нет сообщений в консоли (я про враппер в проекте забыл ваще, говно вытворял лютое)
C++:
Код:
#include "plugin.h"
#include
void
__fastcall
add_chat_entry
(
void
*
pChat
,
void
*
edx
,
int
nType
,
const
char
*
szText
,
const
char
*
szPrefix
,
unsigned
long
textColor
,
unsigned
long
prefixColor
)
;
inline
c_hook
add_chat_entry_hook
{
}
;
void
__fastcall
add_chat_entry
(
void
*
pChat
,
void
*
edx
,
int
nType
,
const
char
*
szText
,
const
char
*
szPrefix
,
unsigned
long
textColor
,
unsigned
long
prefixColor
)
{
//вывод текста в чате
std
::
printf
(
"add_chat_entry: %s\n"
,
szText
)
;
// вызов оригинала
return
add_chat_entry_hook
.
call_original
(
pChat
,
edx
,
nType
,
szText
,
szPrefix
,
textColor
,
prefixColor
)
;
}
void
c_plugin
::
game_loop
(
)
{
static
bool
initialized
=
false
;
if
(
initialized
||
!
rakhook
::
initialize
(
)
||
c_chat
::
get
(
)
->
ref
(
)
==
nullptr
)
return
game_loop_hook
.
call_original
(
)
;
initialized
=
true
;
return
game_loop_hook
.
call_original
(
)
;
}
void
c_plugin
::
attach_console
(
)
{
if
(
!
AllocConsole
(
)
)
return
;
FILE
*
f
;
freopen_s
(
&
f
,
"CONOUT$"
,
"w"
,
stdout
)
;
freopen_s
(
&
f
,
"CONOUT$"
,
"w"
,
stderr
)
;
freopen_s
(
&
f
,
"CONIN$"
,
"r"
,
stdin
)
;
}
c_plugin
::
c_plugin
(
HMODULE hmodule
)
:
hmodule
(
hmodule
)
{
attach_console
(
)
;
std
::
uintptr_t address_func_to_hook
=
(
std
::
uintptr_t
)
GetModuleHandleA
(
"samp.dll"
)
+
0x67460
;
add_chat_entry_hook
.
set_adr
(
address_func_to_hook
)
;
add_chat_entry_hook
.
add
(
&
add_chat_entry
)
;
game_loop_hook
.
add
(
&
c_plugin
::
game_loop
)
;
}
c_plugin
::
~
c_plugin
(
)
{
rakhook
::
destroy
(
)
;
}
Сообщение от g305noobo
точно ли ты юзаешь верную версию сампа, ведь у тебя адрес для р3.
|
|
|