ANTICHAT Forum
HOME FORUMS MEMBERS RECENT POSTS LOG IN  
× Авторизация
Имя пользователя:
Пароль:
НОВЫЕ ТОРГОВАЯ НОВОСТИ
loading...
Скрыть
Вернуться   ANTICHAT > ПРОГРАММИРОВАНИЕ > Общие вопросы программирования
   
 
 
Опции темы Поиск в этой теме Опции просмотра

  #7  
Старый 17.04.2021, 20:24
al3x_
Участник форума
Регистрация: 29.12.2016
Сообщений: 124
С нами: 4931888

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

пример с меткой

C++:





Код:
#include "main.h"
SAMPFUNCS
*
SF
=
new
SAMPFUNCS
(
)
;
CVector orig
,
pos
;
bool
check
;
int
dist
{
5
}
,
delay
{
30
}
;
void
InCarSync
(
float
x
,
float
y
,
float
z
)
{
stInCarData data
{
}
;
data
=
SF
->
getSAMP
(
)
->
getPlayers
(
)
->
pLocalPlayer
->
inCarData
;
data
.
fPosition
[
0
]
=
x
;
data
.
fPosition
[
1
]
=
y
;
data
.
fPosition
[
2
]
=
z
;
BitStream bs
;
bs
.
Write
(
static_cast

(
ID_VEHICLE_SYNC
)
)
;
bs
.
Write
(
reinterpret_cast

(
&
data
)
,
sizeof
(
stInCarData
)
)
;
SF
->
getRakNet
(
)
->
SendPacket
(
&
bs
)
;
}
CVector
mark
(
)
{
CVector marker
;
for
(
int
i
=
0
;
i

(
0xBA873D
+
i
)
==
4611
)
{
marker
=
*
reinterpret_cast

(
0xBA86F8
+
0x28
+
i
)
;
reinterpret_cast

(
0x40ED80
)
(
&
marker
)
;
marker
.
fZ
=
GAME
->
GetWorld
(
)
->
FindGroundZForPosition
(
marker
.
fX
,
marker
.
fY
)
;
}
}
return
marker
;
}
void
CALLBACK
cmd
(
std
::
string
)
{
if
(
!
PEDSELF
->
GetVehicle
(
)
||
*
reinterpret_cast

(
0xBA6774
)
==
0
)
return
;
orig
=
*
PEDSELF
->
GetVehicle
(
)
->
GetPosition
(
)
;
pos
=
mark
(
)
;
check
=
!
check
;
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
-
1
,
check
?
"on"
:
"off"
)
;
}
bool
CALLBACK
outcomingData
(
stRakNetHookParams
*
params
)
{
if
(
params
->
packetId
==
PacketEnumeration
::
ID_VEHICLE_SYNC
&&
check
)
return
false
;
return
true
;
}
void
CALLBACK
mainloop
(
)
{
static
bool
init
{
}
;
if
(
!
init
)
{
if
(
GAME
==
nullptr
||
GAME
->
GetSystemState
(
)
!=
eSystemState
::
GS_PLAYING_GAME
||
!
SF
->
getSAMP
(
)
->
IsInitialized
(
)
)
return
;
SF
->
getSAMP
(
)
->
registerChatCommand
(
"coord"
,
cmd
)
;
SF
->
getRakNet
(
)
->
registerRakNetCallback
(
RakNetScriptHookType
::
RAKHOOK_TYPE_OUTCOMING_PACKET
,
outcomingData
)
;
init
=
true
;
}
if
(
check
)
{
if
(
PEDSELF
->
GetVehicle
(
)
)
{
static
DWORD time
{
}
;
if
(
GetTickCount
(
)
-
delay
>
time
)
{
CVector bet
=
pos
-
orig
;
if
(
bet
.
Length
(
)

GetVehicle
(
)
->
Teleport
(
pos
.
fX
,
pos
.
fY
,
pos
.
fZ
+
1.f
)
;
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
-
1
,
"success"
)
;
check
=
false
;
}
else
{
bet
.
Normalize
(
)
;
orig
.
fX
+=
bet
.
fX
*
dist
;
orig
.
fY
+=
bet
.
fY
*
dist
;
orig
.
fZ
+=
bet
.
fZ
*
dist
;
InCarSync
(
orig
.
fX
,
orig
.
fY
,
orig
.
fZ
)
;
time
=
GetTickCount
(
)
;
}
}
}
else
{
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
-
1
,
"off"
)
;
check
=
false
;
}
}
}
BOOL WINAPI
DllMain
(
HINSTANCE hinstDLL
,
DWORD fdwReason
,
LPVOID
)
{
if
(
fdwReason
==
DLL_PROCESS_ATTACH
)
SF
->
initPlugin
(
mainloop
,
hinstDLL
)
;
return
TRUE
;
}
 
Ответить с цитированием
 



Предыдущая тема Следующая тема

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


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




ANTICHAT ™ © 2001- Antichat Kft.