#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#include <assert.h>
#include <thread>
#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;
}