22.02.2015, 16:46
Hello.
I made a sethealth command, I know there's plenty of them out there, but I just wanted to figure out another way to do it, so basically, if I do /sethealth [someid] [10] it will automatically set the player's health to some other value instead of 10.
Anyone can figure out what am I doing wrong right below?
I made a sethealth command, I know there's plenty of them out there, but I just wanted to figure out another way to do it, so basically, if I do /sethealth [someid] [10] it will automatically set the player's health to some other value instead of 10.
Anyone can figure out what am I doing wrong right below?
PHP код:
CMD:sethealth(playerid, params[])
{
if(!IsAdminLevel(playerid, 1)) return ERROR(playerid, "You need a higher administrator level to use this command.");
if(sscanf(params, "rf", params[0], params[1]))
{
USAGE(playerid, "/sethealth [player/name] [health]");
CMDHELP(playerid, "Will set the specified health to the defined player.");
return 1;
}
if(params[0] == INVALID_PLAYER_ID) return ERROR(playerid, "The ID or name entered was invalid.");
if(params[0] == playerid)
{
AdmCmd(playerid, "You have successfully set your health to %.1f.", params[1]);
}
else
{
AdmCmd(playerid, "You have successfully set %s's health to %.1f.", GetName(params[0]), params[1]);
AdmCmd(playerid, "Administrator %s has set your health to %.1f.", GetName(playerid), params[1]);
}
CMDMessageToAdmins(playerid, "sethealth");
SetPlayerHealth(params[0], params[1]);
return 1;
}