25.08.2014, 12:24
Try This
pawn Код:
CMD:sethealth(playerid, params[])
{
new string[128], playa, health;
if(sscanf(params, "ud", playa, health))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /sethealth [playerid/partofname] [hp]");
return 1;
}
if(PlayerInfo[playerid][pAdmin] >= 6)
{
if(AdminDuty[playerid] != 1 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid,COLOR_WHITE, "You're not on-duty as admin. To access your admin commands you must be on-duty. Type /aduty to go on-duty.");
return 1;
}
if(IsPlayerConnected(playa)) {
if(playa != INVALID_PLAYER_ID)
{
SetPlayerHealth(playa, health);
format(string, sizeof(string), "You have set %s's health to %d.", GetPlayerNameEx(playa), health);
SendClientMessage(playerid, COLOR_WHITE, string);
format(string, sizeof(string), "AdmCmd: %s has set %s's health to %d.", GetPlayerNameEx(playerid), GetPlayerNameEx(playa), health);
ABroadCast(COLOR_LIGHTRED,string, 4);
format(string, sizeof(string), "Admin %s had set your health to %d.", GetPlayerNameEx(playerid), health);
SendClientMessage(playa, COLOR_WHITE, string);
}
}
else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
}
else {
SendClientMessage(playerid, COLOR_GRAD1, "You're not authorized to use that command!");
}
return 1;
}