
01.10.2015, 16:18
|
|
Постоянный
Регистрация: 20.10.2014
Сообщений: 489
С нами:
6086011
Репутация:
108
|
|
Сообщение от Tray228
Почему не проходит вторая задержка в 2 секунды.
После переподключения прошо 2 секунды и телепортировался на определенные кординаты.
PHP:
Код:
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include
#include
#include
#include
#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
SAMPFUNCS
*
SF
=
new
SAMPFUNCS
(
)
;
bool bRequestReconnect
=
false
;
DWORD
time
=
0
;
bool bRequestWait
=
false
;
DWORD
times
=
0
;
void
CALLBACK
telo
(
std
:
:
string param
)
{
SF
-
>
getSAMP
(
)
-
>
disconnect
(
100
)
;
SF
-
>
getSAMP
(
)
-
>
getInfo
(
)
-
>
RestartGame
(
)
;
SF
-
>
getSAMP
(
)
-
>
getInfo
(
)
-
>
iGameState
=
GAMESTATE_WAIT_CONNECT
;
}
void
CALLBACK
teli
(
std
:
:
string param
)
{
bRequestReconnect
=
true
;
time
=
GetTickCount
(
)
;
SF
-
>
getSAMP
(
)
-
>
disconnect
(
100
)
;
SF
-
>
getSAMP
(
)
-
>
getInfo
(
)
-
>
RestartGame
(
)
;
bRequestWait
=
true
;
times
=
GetTickCount
(
)
;
}
void
CALLBACK
tela
(
std
:
:
string param
)
{
ExitProcess
(
1
)
;
}
void
CALLBACK
tels
(
std
:
:
string param
)
{
SF
-
>
getSAMP
(
)
-
>
getChat
(
)
-
>
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"{FF0000}Команды: {0000FF}/recco - {FFFFFF}переподключение без задержки, {0000FF}/reccos - {FFFFFF}переподключение с задержкой в 15 сек, {0000FF}/fquit - {FFFFFF}быстрое закрытие GTA:SA."
)
;
SF
-
>
getSAMP
(
)
-
>
getChat
(
)
-
>
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"{0000FF}/fquit - {FFFFFF}быстрое закрытие GTA:SA."
)
;
}
void
CALLBACK
mainloop
(
)
{
static
bool init
=
false
;
if
(
!
init
)
{
if
(
GAME
==
nullptr
)
return
;
if
(
GAME
-
>
GetSystemState
(
)
!=
eSystemState
:
:
GS_PLAYING_GAME
)
return
;
if
(
!
SF
-
>
getSAMP
(
)
-
>
IsInitialized
(
)
)
return
;
SF
-
>
getSAMP
(
)
-
>
registerChatCommand
(
"recco"
,
telo
)
;
SF
-
>
getSAMP
(
)
-
>
registerChatCommand
(
"reccos"
,
teli
)
;
SF
-
>
getSAMP
(
)
-
>
registerChatCommand
(
"fquit"
,
tela
)
;
SF
-
>
getSAMP
(
)
-
>
registerChatCommand
(
"helrf"
,
tels
)
;
SF
-
>
getSAMP
(
)
-
>
getChat
(
)
-
>
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"{0000FF}Recconect {FFFFFF}and {0000FF}Fast Quit {FFFFFF}by {7CFF00}TRAY228 {FFFFFF}| {FFFFFF}Thanks to {44FF00}urShadow"
)
;
SF
-
>
getSAMP
(
)
-
>
getChat
(
)
-
>
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"Помощь по командам: {0000FF}/helrf "
)
;
init
=
true
;
}
if
(
(
GetTickCount
(
)
-
time
)
>
15000
&&
bRequestReconnect
)
{
SF
-
>
getSAMP
(
)
-
>
getInfo
(
)
-
>
iGameState
=
GAMESTATE_WAIT_CONNECT
;
bRequestReconnect
=
false
;
time
=
GetTickCount
(
)
;
if
(
(
GetTickCount
(
)
-
times
)
>
2000
&&
bRequestWait
)
PEDSELF
-
>
Teleport
(
0
,
0
,
0
)
;
bRequestWait
=
false
;
times
=
GetTickCount
(
)
;
}
}
BOOL
APIENTRY
DllMain
(
HMODULE
hModule
,
DWORD
dwReasonForCall
,
LPVOID
lpReserved
)
{
switch
(
dwReasonForCall
)
{
case
DLL_PROCESS_ATTACH
:
SF
-
>
initPlugin
(
mainloop
,
hModule
)
;
break
;
case
DLL_THREAD_ATTACH
:
case
DLL_THREAD_DETACH
:
case
DLL_PROCESS_DETACH
:
break
;
}
return
TRUE
;
}
попробуй через sleep и поток,хотя я в этом не уверен
|
|
|