31.05.2015, 13:15
PHP код:
if(strcmp(cmd, "/sethp", true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sethp [playerid/PartOfName] [health]");
return 1;
}
new playa;
new health;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /sethp [playerid/PartOfName] [health]");
return 1;
}
health = strvalEx(tmp);
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(PlayerInfo[playa][pAdmin] > PlayerInfo[playerid][pAdmin] && health == 0)
{
format(string, sizeof(string), "{AA3333}AdmCmd{FFFF00}: %s was killed, reason: Attempting to set a higher admin's health to 0.", PlayerName(playerid));
ABroadCast(COLOR_LIGHTRED, string, 1);
SetPlayerHealth(playerid,0);
return 1;
}
SetPlayerHealth(playa, health);
format(string, sizeof(string), " You have set %s's health to %d !",PlayerName(playa),health);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, " You are not authorized to use that command !");
}
}
return 1;
}