Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
- #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;
- DWORD endTime;
- bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride,
- CONST RGNDATA *pDirtyRegion)
- {
- if (SUCCEEDED(SF->getRender()->BeginRender()))
- {
- char text[32] = "нога";
- if (GetTickCount() < endTime)
- sprintf(text, "time: %d", (endTime - GetTickCount()) / 1000 + 1); // + 1, чтобы начиналось с пяти и заканчивалось на единице
- pFont->Print(text, D3DCOLOR_ARGB(255, 255, 255, 0), 500, 500, false);
- SF->getRender()->EndRender();
- }
- return true;
- };
- void CALLBACK timer(std::string)
- {
- endTime = GetTickCount() + 5000; // 5 сек
- }
- 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("timer", timer);
- pFont = SF->getRender()->CreateNewFont("Tahoma", 12, FCR_BORDER);
- SF->getRender()->registerD3DCallback(eDirect3DDeviceMethods::D3DMETHOD_PRESENT, Present);
- init = 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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement