Problem with a command related to health
#3

Try this:
Код:
CMD:sethealth( playerid, params[] ) {

	new targetid,
	    Float:newhealth;
	if(!IsAdminLevel(playerid, 1)) return SendClientMessage(playerid, COLOR_RED, "You need a higher administrator level to use this command!");
	if(sscanf(params, "ui", targetid, newhealth)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /sethealth [playerid] [health]");
	if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Playerid is not an active ID.");
	if(targetid == playerid) {
	
	    format(string, sizeof(string), "You have succesfully set your health to %f", newhealth);
	    SendClientMessage(playerid, COLOR_YELLOW, string);
	    SetPlayerHealth(playerid, newhealth);
	    return 1;
	} else {
		format(string, sizeof(string), "You have succesfully set %s's health to %f", GetName(targetid), newhealth);
		SendClientMessage(playerid, COLOR_YELLOW, string);
		format(string, sizeof(string), "Administrator %s has set your health to %f", GetName(playerid), newhealth);
                SetPlayerHealth(targetid, newhealth);
		return 1;
	}
	return 0;
}
You'd have to edit it so it fits your stocks. I couldn't understand all of them so I did my best.
Reply


Messages In This Thread
Problem with a command related to health - by Magic_Time - 22.02.2015, 16:46
Re: Problem with a command related to health - by xXSPRITEXx - 22.02.2015, 16:53
Re: Problem with a command related to health - by zork - 22.02.2015, 16:56
AW: Problem with a command related to health - by Nero_3D - 22.02.2015, 17:11
Re: Problem with a command related to health - by Magic_Time - 22.02.2015, 18:14

Forum Jump:


Users browsing this thread: 4 Guest(s)