#include <windows.h>
#include <string>
#include <assert.h>
#include <process.h>
#include "SAMPFUNCS_API.h"
#include "game_api\game_api.h"
SAMPFUNCS *SF = new SAMPFUNCS();
stFontInfo *pFont;
bool bstarttext = false;
int iA;
DWORD dgoiA;
bool bgoiA;
bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride,
CONST RGNDATA *pDirtyRegion)
{
if (SUCCEEDED(SF->getRender()->BeginRender())) // если девайс готов к рисованию
{
if (!SF->getGame()->isGTAMenuActive())
{
if (bstarttext)
{
pFont->Print("{87CEFA}iAmerican text invisibleeeeeeeeeeeeeeeeee", D3DCOLOR_ARGB(iA, 255, 255, 255), 330, 330, false); // A = 0
}
}
SF->getRender()->EndRender(); // завершаем рисование
};
return true; // возвращаем положительный результат
};
void Timers() {
if (bgoiA)
{
if (GetTickCount() - dgoiA > 10)
{
iA = 0;
bgoiA = false;
}
}
}
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." );
SF->getRender()->registerD3DCallback(eDirect3DDeviceMethods::D3DMETHOD_PRESENT, Present);
pFont = SF->getRender()->CreateNewFont("Comic Sans MS", 12, FCR_BORDER);
init = true;
}
Timers();
if (SF->getGame()->isKeyPressed(VK_F2)) // Старт текста
{
if (bstarttext)
{
bstarttext = false;
}
else
{
bstarttext = true;
dgoiA = GetTickCount();
iA = 255;
bgoiA = true;
}
}
}
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;
}