14.08.2012, 01:27
Is this what you wanted? Or did you want to make it so if you did /heal [playerid][amount], it would give them the amount, but it would count up the amount until the amount hits 30, in which case you couldn't use the command anymore.
pawn Код:
new Class[MAX_PLAYERS];
new AlreadyHealed[MAX_PLAYERS];
Class[playerid] == 2; //Lets say 2 is the medic class
AlreadyHealed[playerid] == 0; //Place this where you become the class, and when you die.
CMD:heal(playerid, params[])
{
if(Class[playerid] == 2)
{
new targetid;
if(sscanf(params, "u", targetid) return SendClientMessage(playerid, -1, "Usage: /heal [playerid] (heals 30 hp)");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not connected!");
if(AlreadyHealed[playerid] == 0)
{
new Float:health;
GetPlayerHealth(targetid, health);
if(health <= 70) SetPlayerHealth(targetid, health + 30.0);
else SetPlayerHealth(targetid, 100); //This wouldn't be efficient if you have a godmode command or something, though
AlreadyHealed[playerid] == 1;
}
else return SendClientMessage(playerid, -1, "You already healed someone!");
}
else return SendClientMessage(playerid, -1, "You are not a medic!");
return 1;
}