Posts: 12
Threads: 4
Joined: Apr 2018
Reputation:
0
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
Posts: 716
Threads: 92
Joined: May 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;
}
Posts: 357
Threads: 6
Joined: Feb 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.