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

  #11  
Старый 08.10.2021, 20:04
legendabrn
Участник форума
Регистрация: 08.03.2019
Сообщений: 121
С нами: 3781678

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

Цитата:
Сообщение от DANIIL XPC  

How can i remake this in c++ sf?

C++:





Код:
sampRegisterChatCommand
(
'kr'
,
k1d
)
function
k1d
(
params
)
if
params
~
=
nil then
        lua_thread
.
create
(
function
(
)
sampSendChat
(
"text"
)
wait
(
2000
)
sampSendChat
(
"text2"
)
end
)
end
end

C++:





Код:
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include 
#include 
#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
SAMPFUNCS
*
SF
=
new
SAMPFUNCS
(
)
;
void
CALLBACK
k1d
(
std
::
string params
)
{
std
::
thread
test
(
[
]
(
)
{
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"text"
)
;
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
2000
)
)
;
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
D3DCOLOR_XRGB
(
0
,
0xAA
,
0
)
,
"text2"
)
;
}
)
;
test
.
detach
(
)
;
}
void
CALLBACK
mainloop
(
)
{
static
bool
init
=
false
;
if
(
!
init
)
{
if
(
GAME
==
nullptr
&&
GAME
->
GetSystemState
(
)
!=
eSystemState
::
GS_PLAYING_GAME
&&
!
SF
->
getSAMP
(
)
->
IsInitialized
(
)
)
return
;
SF
->
getSAMP
(
)
->
registerChatCommand
(
"kr"
,
k1d
)
;
init
=
true
;
}
}
BOOL APIENTRY
DllMain
(
HMODULE hModule
,
DWORD dwReasonForCall
,
LPVOID lpReserved
)
{
if
(
dwReasonForCall
==
DLL_PROCESS_ATTACH
)
SF
->
initPlugin
(
mainloop
,
hModule
)
;
return
TRUE
;
}
 
Ответить с цитированием
 





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


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




ANTICHAT ™ © 2001- Antichat Kft.