
25.07.2016, 02:11
|
|
Постоянный
Регистрация: 10.01.2016
Сообщений: 922
С нами:
5441999
Репутация:
133
|
|
Сообщение от SR_team
ты isKeyPressed вызываешь до инициализации. После условия if (!init), в конце, добавь else и в нем пиши свой код
Все так же
Сообщение от Спойлер
C++:
Код:
#include
#include
#include
#include
#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
SAMPFUNCS
*
SF
=
new
SAMPFUNCS
(
)
;
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
(
)
->
getChat
(
)
->
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"SAMPFUNCS Plugin loaded."
)
;
init
=
true
;
}
else
{
if
(
SF
->
getGame
(
)
->
isKeyPressed
(
9
)
&&
SF
->
getSAMP
(
)
->
getInput
(
)
->
iInputEnabled
)
{
std
::
string string
;
string
=
SF
->
getSAMP
(
)
->
getChat
(
)
->
GetChatInputText
(
)
;
char
*
msg
=
new
char
[
string
.
length
(
)
+
1
]
;
strrev
(
msg
)
;
char
*
nick
=
strtok
(
msg
,
" "
)
;
SF
->
Log
(
nick
)
;
}
}
}
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
;
}
Мб компилирую как то не правильно?
|
|
|