Help with a command
#2

Код:
CMD:heal(playerid, params[])
{
	new giveplayerid,Float:heal,Float:X, Float:Y, Float:Z;
	new pname[MAX_PLAYER_NAME];
	GetPlayerName(playerid,pname,sizeof(pname));
	if(sscanf(params, "uf", giveplayerid, heal))return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /heal (playerid) (health 1-90)");
        if(heal > 90) return SendClientMessage(playerid,0xFF0000FF, "You can't offer at this player health more than 90 hp.");
        if(playerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Error: Wrong player ID");

	GetPlayerPos(playerid, X, Y, Z);
	if(!IsPlayerInRangeOfPoint(giveplayerid, 5.0, X, Y, Z)) return SendClientMessage(playerid, red, "This player is too far from you, you can't offer him health.");
	
	new Float:health;
 	GetPlayerHealth(giveplayerid, health);
 	if(health > 90.0) return SendClientMessage(playerid,0xFF0000FF, "This player already have full health, you can't offer him a refill.");

	new string[128], string2[128]; 
	format(string, sizeof(string), "You've received an offer to heal you by %s (%d) of %2.1f hp.", pname,playerid,heal); 
	format(string2,sizeof(string2),"~w~You've received an offer to ~r~heal ~w~you by ~g~%s ~r~(%d) ~w~of ~r~%2.1f hp.", pname,playerid,heal); 
	SendClientMessage(giveplayerid, COLOR_PINK, string); 
	SendClientMessage(giveplayerid, COLOR_PINK, "Type in the chat 'Yes' or 'No' to reply the offer."); 
	GameTextForPlayer(giveplayerid,string2,5000,5); 
	pOffersHeal[giveplayerid] = playerid; 
	HealthAmount[giveplayerid] = heal; 
	return true; 
}
Tried this?

It was if(health == 90.0). That means it needs to be exactly 90.0%.
Reply


Messages In This Thread
Help with a command - by Face9000 - 12.10.2012, 20:01
Re: Help with a command - by RedJohn - 12.10.2012, 20:09
Re: Help with a command - by Face9000 - 12.10.2012, 21:24

Forum Jump:


Users browsing this thread: 1 Guest(s)