Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <string>
- #include <assert.h>
- #include <process.h>
- #include <time.h>
- #include "SAMPFUNCS_API.h"
- #include "game_api\game_api.h"
- SAMPFUNCS *SF = new SAMPFUNCS();
- stFontInfo *pFont;
- BOOL ti_status = TRUE;
- const std::string currentDateTime() {
- time_t now = time(0);
- struct tm tstruct;
- char buf[80];
- tstruct = *localtime(&now);
- strftime(buf, sizeof(buf), "%Y-%m-%d %X", &tstruct);
- return buf;
- }
- void CALLBACK cmd_ti(std::string) {
- ti_status = !ti_status;
- }
- bool CALLBACK Present(CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride,
- CONST RGNDATA *pDirtyRegion)
- {
- if (SUCCEEDED(SF->getRender()->BeginRender()))
- {
- if (ti_status == TRUE) {
- if (SF->getGame()->isGTAMenuActive() == FALSE) {
- std::string curtime = currentDateTime();
- std::string curplayer = SF->getSAMP()->getPlayers()->szLocalPlayerName;
- int curid = SF->getSAMP()->getPlayers()->sLocalPlayerID;
- SF->getSAMP()->getInfo()->UpdateScoreAndPing();
- int curlvl = SF->getSAMP()->getPlayers()->iLocalPlayerScore;
- int curpng = SF->getSAMP()->getPlayers()->iLocalPlayerPing;
- std::string allinf = "Локальное время: " + curtime + "\r\nID: " + std::to_string(curid) + "\r\nНик: " + curplayer + "\r\nУровень: " + std::to_string(curlvl) + "\r\nПинг: " + std::to_string(curpng);
- pFont->Print(allinf.c_str(), D3DCOLOR_ARGB(255, 000, 255, 000), 50, 330, false);
- }
- }
- SF->getRender()->EndRender();
- };
- return true;
- };
- 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("ti", cmd_ti);
- SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0x77, 0xCC), "[0.3] StatisticPanel | /ti");
- 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