13.03.2014, 23:24
Yes, it would work. However, you're creating unnecessary variables where you don't need them, and too much cell size.
A shorter more efficient version would be:
A shorter more efficient version would be:
pawn Код:
if(strcmp("/heal", cmdtext, true) == 0)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(Health < 50.0) return SendClientMessage(playerid, 0xD10000FF, "You are too low on health to heal yourself!");
new cash = GetPlayerMoney(playerid);
if(cash < 1000)
{
new str[90];
format(str, sizeof(str), "You haven't got enough money to heal yourself (Your money: $%d Needed: $1000)", cash);
return SendClientMessage(playerid, 0xD10000FF, str);
}
SetPlayerHealth(playerid, 100.0);
SendClientMessage(playerid, 0x009900FF, "You have healed yourself for $1000!");
GivePlayerMoney(playerid, -1000);
return 1;
}