#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();
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];
stUnoccupiedData *ppPlayer; // ПЫТАЛСЯ ПОЛУЧИТЬ
if (!pPlayer) return;
sprintf(buf, "Nickname - %s, Ping - %d, Score - %d, isNPC - %d, HP - %0.0f AFKState - %d",
pPlayer->szPlayerName,
pPlayer->iPing,
pPlayer->iScore,
pPlayer->iIsNPC,
ppPlayer->fHealth, // ПЫТАЛСЯ ПОЛУЧИТЬ
pPlayer->pPlayerData->iAFKState == 2);
SF->getSAMP()->getChat()->AddChatMessage(-1, buf);
};
void CALLBACK mainloop()
{
static bool init = false;
if (!init)
{
SF->getSAMP()->registerChatCommand("showinfo", cmd_show_info_player);
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;
}