COMMAND:heal(playerid, params[]) {
new Float:health, user, Float:x, Float:y, Float:z;
if (sscanf(params, "i", user)) return SendClientMessage(playerid, COLOR_RED, "Usge: /heal <playerid>");
GetPlayerPos(user, x, y, z); GetPlayerHealth(user, health);
if (!IsPlayerInRangeOfPoint(playerid, 5, x, y, z)) return SendClientMessage(playerid, COLOR_RED, "Your not close enough");
if (health > 50) return SendClientMessage(playerid, COLOR_RED, "Player doesn't need this now");
SendClientMessage(playerid, COLOR_GREEN, "You have just been healed!");
SetPlayerHealth(playerid, health + 50);
return 1;
}
|
For this command you will need zcmd include, click here to download it.
I suggest you read and learn about Zcmd. Click here and here When you download it, put it int your include folder which is located in your pawno folder (pawno>include) Then you can download your Heal command. Heal.pwn Heal.amx Then open your server.cfg file and add Healzcmd in to it |

|
Find if the player is close enough to the one you want to /heal.
Check if his health is low enough. Get the players health and add 50 to it. |
COMMAND:heal(playerid, params[])
{
if(Class[playerid] == 4)
{
new Float:health, user, Float:x, Float:y, Float:z;
if (sscanf(params, "i", user)) return SendClientMessage(playerid, COLOR_SERVER, "[USAGE]: /heal [playerid]");
GetPlayerPos(user, x, y, z); GetPlayerHealth(user, health);
if (!IsPlayerInRangeOfPoint(playerid, 5, x, y, z)) return SendClientMessage(playerid, COLOR_SERVER, "You Are Not Close Enough To The Player!");
if (health > 50) return SendClientMessage(playerid, COLOR_SERVER, "Player's Health Is Above 50, And Cannot Be Healed!");
SendClientMessage(playerid, COLOR_ORANGE, "You have just been healed!");
SetPlayerHealth(playerid, health + 50);
}
else return SendClientMessage(playerid,COLOR_SERVER_WARNING,"You Are Not An Medic!");
return 1;
}