[HELP] Medic Command
#1

Solved, Thanks!
Reply
#2

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.

Example:
Код:
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;
}
Reply
#3

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
Reply
#4

Quote:
Originally Posted by zack3021
Посмотреть сообщение
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
I Already Know And Use ZCMD For Everything, And Thanks By The Way, Will Check It Out If Muffins Idea Doesnt Work



Quote:
Originally Posted by mrmuffins
Посмотреть сообщение
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.
Thanks Man, Will Test It Now!
Reply
#5

Thanks mrmuffin, it worked, though i added about 4 extra lines to it, so it worked for a certain class
Reply
#6

Can i see what you added cuz when i remade it it dont work for me.

I only added lines for class then it dont work but ill try to fix it. Please let me see what u added.
Reply
#7

Note: This wont work for you, as we use a special Team setup, which i integrated into this code, but here ya go:

Код:
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;
}
By The way, i can help if you give me the error messages etc..
Reply
#8

lol the reason mine did not work was because i had a /heal command for playerid so this one wont work because of the one i had loaded

Thanks but i try to fix errors on my own (No offence) but i think fixing errors is a great way to learn, and the errors tell you exactly what to do to fix them.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)