
13.02.2024, 23:08
|
|
Новичок
Регистрация: 27.12.2023
Сообщений: 18
С нами:
1253989
Репутация:
3
|
|
Помогите пожалуйста, при получении любого пакета игра закрывается.
код:
Код:
#include
#include "main.h"
#include
#include
#include
#include "fstream"
using
namespace
std
;
SAMPFUNCS
*
SF
=
new
SAMPFUNCS
(
)
;
void
__stdcall
initScript
(
string
)
;
void
logSF
(
char
)
;
static
bool
isActive
=
false
;
static
bool
CALLBACK
incomingPacket
(
stRakNetHookParams
*
params
)
{
return
true
;
}
static
void
__stdcall
mainloop
(
)
{
static
bool
initialized
=
false
;
if
(
!
initialized
)
{
if
(
GAME
&&
GAME
->
GetSystemState
(
)
==
eSystemState
::
GS_PLAYING_GAME
&&
SF
->
getSAMP
(
)
->
IsInitialized
(
)
)
{
initialized
=
true
;
SF
->
getRakNet
(
)
->
registerRakNetCallback
(
RakNetScriptHookType
::
RAKHOOK_TYPE_INCOMING_PACKET
,
incomingPacket
)
;
SF
->
getSAMP
(
)
->
registerChatCommand
(
"stallSkip"
,
initScript
)
;
}
}
}
void
__stdcall
initScript
(
string
)
{
string text
;
int
color
;
if
(
!
isActive
)
{
color
=
D3DCOLOR_ARGB
(
255
,
0
,
255
,
0
)
;
text
=
"[******] Активирован"
;
}
else
{
color
=
D3DCOLOR_ARGB
(
255
,
255
,
0
,
0
)
;
text
=
"[******] Деактивирован"
;
}
isActive
^=
true
;
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
color
,
"%s"
,
text
)
;
}
void
logSF
(
char
text
)
{
ofstream
outputFile
(
"SAMPFUNCS/logs.txt"
)
;
if
(
outputFile
.
is_open
(
)
)
{
outputFile
initPlugin
(
mainloop
,
hModule
)
;
return
TRUE
;
}
|
|
|