21.09.2014, 07:34
pawn Код:
CMD:sethp(playerid, params[])
{
new id, string[128], Float:health;
if(pInfo[playerid][AdminLevel] <= 1) return SendClientMessage(playerid, COLOR_RED, "You are not an admin. Therefore you can not use this command.");
else if(sscanf(params, "uf", id, health)) return SendClientMessage(playerid, -1, "SYNTAX: /SetHp [ID] [HP]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "The ID specified seems to be invalid.");
else if(health < 0 || health > 100) return SendClientMessage(playerid, COLOR_RED, "You may only set health from 0 to 100.");
else
{
format(string, sizeof(string), "You have set %s(%d)'s health to %f", GetName(id), id, health);
SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "%s(%d) has set your health to %f", GetName(playerid), playerid, health);
SendClientMessage(playerid, COLOR_RED, string);
SetPlayerHealth(id, health);
}
return 1;
}