SA-MP Forums Archive
Help health - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help health (/showthread.php?tid=659678)



Help health - Chanty420 - 12.10.2018

Hello guy's, i just wanted to know how to make a command, which show the player health to admin's to detect if he is a hacker.
Like this if /checkhp 0 = Player 'example' has health 93.5 for example
Help me please


Re: Help health - KinderClans - 12.10.2018

pawn Код:
ReturnHealth(playerid)
{
    static Float:amount;

    GetPlayerHealth(playerid, amount);

    return floatround(amount, floatround_round);
}

    CMD:health(playerid, params[])
{
    new targetid, pName[MAX_PLAYER_NAME];

    GetPlayerName(targetid, pName, sizeof(pName));

    if(sscanf(params, "r", targetid)) return SendClientMessage(playerid, -1, "* [USAGE]: /health [playerid/name]");

    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, .1, "* The player you specified isn't connected or is invalid.");
   
    new str[100];
   
    format(str,sizeof str,"* %s's (%d) health is %f", pName, targetid, ReturnHealth(targetid));
   
    SendClientMessage(playerid, str, -1);
    return 1;
}



Re: Help health - UFF - 12.10.2018

Quote:
Originally Posted by KinderClans
Посмотреть сообщение
pawn Код:
ReturnHealth(playerid)
{
    static Float:amount;

    GetPlayerHealth(playerid, amount);

    return floatround(amount, floatround_round);
}

    CMD:health(playerid, params[])
{
    new targetid, pName[MAX_PLAYER_NAME];

    GetPlayerName(targetid, pName, sizeof(pName));

    if(sscanf(params, "r", targetid)) return SendClientMessage(playerid, -1, "* [USAGE]: /health [playerid/name]");

    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, .1, "* The player you specified isn't connected or is invalid.");
   
    new str[100];
   
    format(str,sizeof str,"* %s's (%d) health is %f", pName, targetid, ReturnHealth(targetid));
   
    SendClientMessage(playerid, str, -1);
    return 1;
}
Код:
GetPlayerName(targetid, pName, sizeof(pName));
Should be used after the sscanf.