#include <Windows.h>
#include "main.h"
SAMPFUNCS *SF = new SAMPFUNCS();
void CALLBACK cmd_show_info_player(std::string param)
{
if (param.empty()) return;
int i = std::stoi(param);
char buf[128];
stRemotePlayer* pPlayer = SF->getSAMP()->getPlayers()->pRemotePlayer[i];
if (!pPlayer) return;
sprintf(buf, "Nickname - %s, Ping - %d, Score - %d, isNPC - %d, AFKState - %d",
pPlayer->szPlayerName,
pPlayer->iPing,
pPlayer->iScore,
pPlayer->iIsNPC,
pPlayer->pPlayerData->iAFKState == 2);
SF->getSAMP()->getChat()->AddChatMessage(-1, buf);
};
void __stdcall mainloop()
{
static bool initialized = false;
if (!initialized)
{
if (GAME && GAME->GetSystemState() == eSystemState::GS_PLAYING_GAME && SF->getSAMP()->IsInitialized())
{
SF->getSAMP()->registerChatCommand("showinfo", cmd_show_info_player);
initialized = true;
SF->getSAMP()->getChat()->AddChatMessage(D3DCOLOR_XRGB(0, 0xAA, 0), "Bl");
}
}
}
BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReasonForCall, LPVOID lpReserved)
{
if (dwReasonForCall == DLL_PROCESS_ATTACH)
SF->initPlugin(mainloop, hModule);
return TRUE;
}