HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
Нет аккаунта? Регистрация
Баннер 1   Баннер 2
НОВЫЕ ТОРГОВАЯ НОВОСТИ ЧАТ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby
   
Ответ
 
Опции темы Поиск в этой теме Опции просмотра

  #51  
Старый 24.07.2020, 12:21
loganhackerdff
Постоянный
Регистрация: 24.07.2017
Сообщений: 867
С нами: 4633764

Репутация: 148


По умолчанию

Функция копирование текста в буффер

C++:





Код:
void
SetClipboardText
(
char
*
txt
)
{
if
(
OpenClipboard
(
NULL
)
)
{
HGLOBAL clipbuffer
;
char
*
buffer
;
EmptyClipboard
(
)
;
clipbuffer
=
GlobalAlloc
(
GMEM_DDESHARE
,
strlen
(
txt
)
+
1
)
;
buffer
=
(
char
*
)
GlobalLock
(
clipbuffer
)
;
strcpy
(
buffer
,
txt
)
;
GlobalUnlock
(
clipbuffer
)
;
SetClipboardData
(
CF_TEXT
,
clipbuffer
)
;
CloseClipboard
(
)
;
}
}


Получает путь к корневой папке gta_sa.exe

C++:





Код:
void
GetPath
(
char
*
OutPutBuffer
)
{
GetModuleFileNameA
(
GetModuleHandleA
(
NULL
)
,
OutPutBuffer
,
260
)
;
memset
(
OutPutBuffer
+
(
strlen
(
OutPutBuffer
)
-
strlen
(
"/gta_sa.exe"
)
)
,
0
,
1
)
;
}


Устанавливает позицию ImGui окна посередине экрана (Только для самп)

C++:





Код:
void
setNextWindowPositionCenter
(
)
{
ImGui
::
SetNextWindowPos
(
ImVec2
(
*
(
int
*
)
0xC9C040
/
2
,
*
(
int
*
)
0xC9C044
/
2
)
,
ImGuiCond_Once
,
ImVec2
(
0.5F
,
0.5F
)
)
;
}
 
Ответить с цитированием

  #52  
Старый 24.07.2020, 12:47
MISTER_GONWIK
Познавший АНТИЧАТ
Регистрация: 09.03.2013
Сообщений: 1,262
С нами: 6935116

Репутация: 183


По умолчанию

Цитата:
Сообщение от loganhackerdff  

Функция копирование текста в буффер

C++:





Код:
void
SetClipboardText
(
char
*
txt
)
{
if
(
OpenClipboard
(
NULL
)
)
{
HGLOBAL clipbuffer
;
char
*
buffer
;
EmptyClipboard
(
)
;
clipbuffer
=
GlobalAlloc
(
GMEM_DDESHARE
,
strlen
(
txt
)
+
1
)
;
buffer
=
(
char
*
)
GlobalLock
(
clipbuffer
)
;
strcpy
(
buffer
,
txt
)
;
GlobalUnlock
(
clipbuffer
)
;
SetClipboardData
(
CF_TEXT
,
clipbuffer
)
;
CloseClipboard
(
)
;
}
}


Получает путь к корневой папке gta_sa.exe

C++:





Код:
void
GetPath
(
char
*
OutPutBuffer
)
{
GetModuleFileNameA
(
GetModuleHandleA
(
NULL
)
,
OutPutBuffer
,
260
)
;
memset
(
OutPutBuffer
+
(
strlen
(
OutPutBuffer
)
-
strlen
(
"/gta_sa.exe"
)
)
,
0
,
1
)
;
}


Устанавливает позицию ImGui окна посередине экрана (Только для самп)

C++:





Код:
void
setNextWindowPositionCenter
(
)
{
ImGui
::
SetNextWindowPos
(
ImVec2
(
*
(
int
*
)
0xC9C040
/
2
,
*
(
int
*
)
0xC9C044
/
2
)
,
ImGuiCond_Once
,
ImVec2
(
0.5F
,
0.5F
)
)
;
}


Выводит крутой череп в sf консоль (Только для самп)

C++:





Код:
void
PrintCHEREP
(
)
{
char
*
XXX
;
XXX
=
(
char
*
)
malloc
(
1980
)
;
XXX
=
"___________________0000000000000000000____________________\n"
"_________________000000_____________0000000________________\n"
"______________0000_______________________0000______________\n"
"_____________000_____________________________00____________\n"
"____________00________________________________00___________\n"
"___________00_________________________________00___________\n"
"__________00___________________________________00__________\n"
"__________00_00_____________________________00_00__________\n"
"__________00_00_____________________________00__0__________\n"
"__________00_00_____________________________00__0__________\n"
"__________00__00____________________________00_00__________\n"
"__________00__00___________________________00__00__________\n"
"___________00_00___00000000_____00000000___00_00___________\n"
"____________0000_0000000000_____0000000000_00000___________\n"
"_____________000_0000000000_____0000000000_000_____________\n"
"____000_______00__00000000_______000000000__00______0000___\n"
"___00000_____00___0000000___000___0000000___00_____000000__\n"
"__00___00____00_____000____00000____000_____00____00___00__\n"
"_000____0000__00__________0000000__________00__0000____000_\n"
"00_________00000000_______0000000_______000000000________00\n"
"000000000_____00000000____0000000____00000000______00000000\n"
"__0000_00000______00000______________000_00_____000000_000_\n"
"__________000000__000__00___________00__000__000000________\n"
"______________000000_00_00000000000_00_000000______________\n"
"__________________00_00_0_0_0_0_0_0_0_0_00_________________\n"
"________________0000__0_0_0_0_0_0_0_0___00000______________\n"
"____________00000_00___0000000000000___00_00000____________\n"
"____0000000000_____00_________________00______000000000____\n"
"___00___________0000000_____________00000000__________00___\n"
"____000_____00000_____000000000000000_____00000_____000____\n"
"______00___000___________000000000___________000___00______\n"
"______00__00___________________________________00__00______\n"
"_______0000_____________________________________0000_______\n"
;
SF
->
LogConsole
(
XXX
)
;
free
(
XXX
)
;
}


Цитата:
Сообщение от Спойлер  


ужасно.
 
Ответить с цитированием

  #53  
Старый 25.07.2020, 16:43
Dark_Knight
Флудер
Регистрация: 18.03.2013
Сообщений: 4,080
С нами: 6921957

Репутация: 183


По умолчанию

Цитата:
Сообщение от Cake_  

C++:





Код:
#include 
#include 
std
::
string
getFileDirectoryPath
(
std
::
string filename
)
;
{
}

C++:





Код:
namespace
fs
=
std
::
experimental
::
::
system
;
std
::
string path
=
fs
::
current_path
(
)
.
string
(
)
;


Разве так не проще?
 
Ответить с цитированием

  #54  
Старый 30.07.2020, 12:58
Const
Новичок
Регистрация: 28.10.2018
Сообщений: 28
С нами: 3970020

Репутация: 18
По умолчанию

FPS Unlock:





Код:
uint32_t
dwSAMPHandle
=
reinterpret_cast

(
LoadLibrary
(
"SAMP.dll"
)
)
;
// Instead of this use your variable.
if
(
!
dwSAMPHandle
)
return
;
// Maybe, samp in this time didn't initialized.
auto
PatchFrameLimiter
=
[
&
]
(
)
{
/* Set frame sleep to NULL */
*
reinterpret_cast

(
0x00BAB318
)
=
0x00
;
*
reinterpret_cast

(
0x0053E94C
)
=
0x00
;
DWORD dwProtection
=
PAGE_EXECUTE_READWRITE
;
VirtualProtect
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
6UL
,
dwProtection
,
&
dwProtection
)
;
memset
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
0x90
,
6UL
)
;
// Nop all instructions (size of jne 6 bytes, not 5, like default jmp).
memcpy
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
"\x0F\x85"
,
2UL
)
;
// First two bytes it's opcode in jne.
*
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
+
2
)
=
(
dwSAMPHandle
+
0x9D2F9
)
-
(
dwSAMPHandle
+
0x9D183
)
-
6UL
;
// Fill another 4 bytes by relative address on epilogue.
VirtualProtect
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
6UL
,
dwProtection
,
&
dwProtection
)
;
}
;
auto
RestorePatch
=
[
&
]
(
)
{
/* Restore frame sleep */
*
reinterpret_cast

(
0x00BAB318
)
=
0x01
;
*
reinterpret_cast

(
0x0053E94C
)
=
0x02
;
DWORD dwProtection
=
PAGE_EXECUTE_READWRITE
;
VirtualProtect
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
6UL
,
dwProtection
,
&
dwProtection
)
;
memcpy
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
"\x75\x2C\xB8\x00\x80"
,
6UL
)
;
// Restore original instruction.
VirtualProtect
(
reinterpret_cast

(
dwSAMPHandle
+
0x9D183
)
,
6UL
,
dwProtection
,
&
dwProtection
)
;
}
;
 
Ответить с цитированием

  #55  
Старый 03.08.2020, 14:17
_=Gigant=_
Участник форума
Регистрация: 19.01.2017
Сообщений: 130
С нами: 4901705

Репутация: 98
По умолчанию

drawing imgui on players

sa-mp-010.png_=Gigant=_ · 3 Авг 2020 в 13:17' data-fancybox="lb-post-539661" data-lb-caption-extra-html="" data-lb-sidebar-href="" data-single-image="1" data-src="https://www.blast.hk/attachments/64235/" style="cursor: pointer;" title="sa-mp-010.png">


C++:





[CODE]
for
(
int
iplayers
=
0
;
iplayers

iIsListed
[
iplayers
]
!=
1
)
continue
;
actor_info
*
info
=
getGTAPedFromSAMPPlayerID
(
iplayers
)
;
if
(
!
info
)
continue
;
float
*
pPos
=
&
info
->
base
.
matrix
[
12
]
;
if
(
vect3_dist
(
pPos
,
&
g_Players
->
pLocalPlayer
->
pSAMP_Actor
->
pGTA_Ped
->
base
.
matrix
[
4
*
3
]
)
>
100.0
)
continue
;
D3DXVECTOR3 draw_getvec
,
info_toscreen
;
draw_getvec
.
x
=
pPos
[
0
]
;
draw_getvec
.
y
=
pPos
[
1
]
;
draw_getvec
.
z
=
pPos
[
2
]
;
CalcScreenCoors
(
&
draw_getvec
,
&
info_toscreen
)
;
if
(
info_toscreen
.
z

 
Ответить с цитированием

  #56  
Старый 21.09.2020, 21:03
imring
Флудер
Регистрация: 03.08.2016
Сообщений: 2,363
С нами: 5145387

Репутация: 183


По умолчанию

включает курсор (нужен plugin-sdk)

C++:





Код:
#ifdef IMGUI_VERSION
void
show_cursor
(
bool
show
,
bool
is_imgui
=
false
)
#else
void
show_cursor
(
bool
show
)
#endif
{
if
(
show
)
{
patch
::
Nop
(
0x541DF5
,
5
)
;
// don't call CControllerConfigManager::AffectPadFromKeyBoard
patch
::
Nop
(
0x53F417
,
5
)
;
// don't call CPad__getMouseState
patch
::
SetRaw
(
0x53F41F
,
"\x33\xC0\x0F\x84"
,
4
)
;
// test eax, eax -> xor eax, eax
// jl loc_53F526 -> jz loc_53F526
patch
::
PutRetn
(
0x6194A0
)
;
// disable RsMouseSetPos (ret)
#ifdef IMGUI_VERSION
if
(
is_imgui
)
ImGui
::
GetIO
(
)
.
MouseDrawCursor
=
true
;
else
#endif
static_cast

(
RwD3D9GetCurrentD3DDevice
(
)
)
->
ShowCursor
(
TRUE
)
;
}
else
{
patch
::
SetRaw
(
0x541DF5
,
"\xE8\x46\xF3\xFE\xFF"
,
5
)
;
// call CControllerConfigManager::AffectPadFromKeyBoard
patch
::
SetRaw
(
0x53F417
,
"\xE8\xB4\x7A\x20\x00"
,
5
)
;
// call CPad__getMouseState
patch
::
SetRaw
(
0x53F41F
,
"\x85\xC0\x0F\x8C"
,
4
)
;
// xor eax, eax -> test eax, eax
// jz loc_53F526 -> jl loc_53F526
patch
::
SetUChar
(
0x6194A0
,
0xE9
)
;
// jmp setup
static_cast

(
RwD3D9GetCurrentD3DDevice
(
)
)
->
ShowCursor
(
FALSE
)
;
#ifdef IMGUI_VERSION
ImGui
::
GetIO
(
)
.
MouseDrawCursor
=
false
;
#endif
}
CPad
::
NewMouseControllerState
.
X
=
0
;
CPad
::
NewMouseControllerState
.
Y
=
0
;
Call

(
)
;
// CPad::ClearMouseHistory
Call

(
)
;
// CPad::UpdatePads
}
 
Ответить с цитированием

  #57  
Старый 06.10.2020, 20:06
AdCKuY_DpO4uLa
Постоянный
Регистрация: 05.08.2018
Сообщений: 372
С нами: 4091290

Репутация: 213
По умолчанию

отключает и включает возможность открывать и закрывать таб (0.3.7-R1)

C++:





Код:
memcpy
(
(
void
*
)
(
GetModuleHandleA
(
"samp.dll"
)
+
0x6AD33
)
,
(
BYTE
*
)
"\x83\x3E\x01"
,
3
)
;
//отключить таб
memcpy
(
(
void
*
)
(
GetModuleHandleA
(
"samp.dll"
)
+
0x6AD33
)
,
(
BYTE
*
)
"\x83\x3E\x00"
,
3
)
;
//включить таб
 
Ответить с цитированием

  #58  
Старый 06.10.2020, 21:07
kin4stat
Флудер
Регистрация: 06.11.2017
Сообщений: 2,759
С нами: 4483143

Репутация: 183


По умолчанию

Цитата:
Сообщение от AdCKuY_DpO4uLa  

отключает и включает возможность открывать и закрывать таб (0.3.7-R1)

C++:





Код:
memcpy
(
(
void
*
)
(
GetModuleHandleA
(
"samp.dll"
)
+
0x6AD33
)
,
(
BYTE
*
)
"\x83\x3E\x01"
,
3
)
;
//отключить таб
memcpy
(
(
void
*
)
(
GetModuleHandleA
(
"samp.dll"
)
+
0x6AD33
)
,
(
BYTE
*
)
"\x83\x3E\x00"
,
3
)
;
//включить таб

Крашнет, т.к. протекцию памяти не снял. И вообще, с такой мелочью лучше в луа сниппеты
 
Ответить с цитированием

  #59  
Старый 05.01.2021, 06:01
Gunborg Johansson
Познающий
Регистрация: 30.10.2020
Сообщений: 32
С нами: 2914352

Репутация: 8
По умолчанию

Цитата:
Сообщение от imring  

включает курсор (нужен plugin-sdk)

C++:





Код:
#ifdef IMGUI_VERSION
void
show_cursor
(
bool
show
,
bool
is_imgui
=
false
)
#else
void
show_cursor
(
bool
show
)
#endif
{
if
(
show
)
{
patch
::
Nop
(
0x541DF5
,
5
)
;
// don't call CControllerConfigManager::AffectPadFromKeyBoard
patch
::
Nop
(
0x53F417
,
5
)
;
// don't call CPad__getMouseState
patch
::
SetRaw
(
0x53F41F
,
"\x33\xC0\x0F\x84"
,
4
)
;
// test eax, eax -> xor eax, eax
// jl loc_53F526 -> jz loc_53F526
patch
::
PutRetn
(
0x6194A0
)
;
// disable RsMouseSetPos (ret)
#ifdef IMGUI_VERSION
if
(
is_imgui
)
ImGui
::
GetIO
(
)
.
MouseDrawCursor
=
true
;
else
#endif
static_cast

(
RwD3D9GetCurrentD3DDevice
(
)
)
->
ShowCursor
(
TRUE
)
;
}
else
{
patch
::
SetRaw
(
0x541DF5
,
"\xE8\x46\xF3\xFE\xFF"
,
5
)
;
// call CControllerConfigManager::AffectPadFromKeyBoard
patch
::
SetRaw
(
0x53F417
,
"\xE8\xB4\x7A\x20\x00"
,
5
)
;
// call CPad__getMouseState
patch
::
SetRaw
(
0x53F41F
,
"\x85\xC0\x0F\x8C"
,
4
)
;
// xor eax, eax -> test eax, eax
// jz loc_53F526 -> jl loc_53F526
patch
::
SetUChar
(
0x6194A0
,
0xE9
)
;
// jmp setup
static_cast

(
RwD3D9GetCurrentD3DDevice
(
)
)
->
ShowCursor
(
FALSE
)
;
#ifdef IMGUI_VERSION
ImGui
::
GetIO
(
)
.
MouseDrawCursor
=
false
;
#endif
}
CPad
::
NewMouseControllerState
.
X
=
0
;
CPad
::
NewMouseControllerState
.
Y
=
0
;
Call

(
)
;
// CPad::ClearMouseHistory
Call

(
)
;
// CPad::UpdatePads
}

Alternative realization (w/o plugin sdk):

C++:





Код:
void
showCursor
(
bool
state
)
{
using
RwD3D9GetCurrentD3DDevice_t
=
LPDIRECT3DDEVICE9
(
__cdecl
*
)
(
)
;
auto
rwCurrentD3dDevice
{
reinterpret_cast

(
0x7F9D50U
)
(
)
}
;
if
(
nullptr
==
rwCurrentD3dDevice
)
{
return
;
}
static
DWORD
        updateMouseProtection
,
rsMouseSetPosProtFirst
,
rsMouseSetPosProtSecond
;
if
(
state
)
{
::
VirtualProtect
(
reinterpret_cast

(
0x53F3C6U
)
,
5U
,
PAGE_EXECUTE_READWRITE
,
&
updateMouseProtection
)
;
::
VirtualProtect
(
reinterpret_cast

(
0x53E9F1U
)
,
5U
,
PAGE_EXECUTE_READWRITE
,
&
rsMouseSetPosProtFirst
)
;
::
VirtualProtect
(
reinterpret_cast

(
0x748A1BU
)
,
5U
,
PAGE_EXECUTE_READWRITE
,
&
rsMouseSetPosProtSecond
)
;
// NOP: CPad::UpdateMouse
*
reinterpret_cast

(
0x53F3C6U
)
=
0xE9U
;
*
reinterpret_cast

(
0x53F3C6U
+
1U
)
=
0x15BU
;
// NOP: RsMouseSetPos
memset
(
reinterpret_cast

(
0x53E9F1U
)
,
0x90
,
5U
)
;
memset
(
reinterpret_cast

(
0x748A1BU
)
,
0x90
,
5U
)
;
rwCurrentD3dDevice
->
ShowCursor
(
TRUE
)
;
}
else
{
// Original: CPad::UpdateMouse
memcpy
(
reinterpret_cast

(
0x53F3C6U
)
,
"\xE8\x95\x6C\x20\x00"
,
5U
)
;
// Original: RsMouseSetPos
memcpy
(
reinterpret_cast

(
0x53E9F1U
)
,
"\xE8\xAA\xAA\x0D\x00"
,
5U
)
;
memcpy
(
reinterpret_cast

(
0x748A1BU
)
,
"\xE8\x80\x0A\xED\xFF"
,
5U
)
;
using
CPad_ClearMouseHistory_t
=
void
(
__cdecl
*
)
(
)
;
using
CPad_UpdatePads_t
=
void
(
__cdecl
*
)
(
)
;
reinterpret_cast

(
0x541BD0U
)
(
)
;
reinterpret_cast

(
0x541DD0U
)
(
)
;
::
VirtualProtect
(
reinterpret_cast

(
0x53F3C6U
)
,
5U
,
updateMouseProtection
,
&
updateMouseProtection
)
;
::
VirtualProtect
(
reinterpret_cast

(
0x53E9F1U
)
,
5U
,
rsMouseSetPosProtFirst
,
&
rsMouseSetPosProtFirst
)
;
::
VirtualProtect
(
reinterpret_cast

(
0x748A1BU
)
,
5U
,
rsMouseSetPosProtSecond
,
&
rsMouseSetPosProtSecond
)
;
rwCurrentD3dDevice
->
ShowCursor
(
FALSE
)
;
}
}
 
Ответить с цитированием

  #60  
Старый 08.01.2021, 07:36
Gunborg Johansson
Познающий
Регистрация: 30.10.2020
Сообщений: 32
С нами: 2914352

Репутация: 8
По умолчанию

Function for converting game 3D coordinates to screen coordinates (noticed that some use the self-written CalcScreenCoors function, lol)

C++:





Код:
namespace
Game
{
struct
Vector
{
float
x
,
y
,
z
;
Vector
(
float
_x
,
float
_y
,
float
_z
)
:
x
(
_x
)
,
y
(
_y
)
,
z
(
_z
)
{
}
Vector
(
)
{
x
=
y
=
z
=
0
;
}
}
;
}
Game
::
Vector
convertGameCoordsToScreen
(
Game
::
Vector worldCoords
)
{
using
CalcScreenCoors_t
=
bool
(
__cdecl
*
)
(
Game
::
Vector
*
,
Game
::
Vector
*
,
float
*
,
float
*
)
;
Game
::
Vector screenCoords
;
auto
gameFunction
{
reinterpret_cast

(
0x71DA00U
)
}
;
float
unusedParams
[
2U
]
{
0
}
;
gameFunction
(
&
worldCoords
,
&
screenCoords
,
&
unusedParams
[
0U
]
,
&
unusedParams
[
1U
]
)
;
return
screenCoords
;
}
 
Ответить с цитированием
Ответ





Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
 


Быстрый переход




ANTICHAT ™ © 2001- Antichat Kft.