Help with /heal command
#1

Can you help me with my /heal cmd?
Код:
dcmd_heal(playerid, params[])
{
	if (strlen(params))
	{
		id = strval(params[0]);
		if (IsPlayerConnected(id))
		{
			if(Medic[playerid] == 1 || IsPlayerInVehicle(playerid, 416))
			{
				SetPlayerHealth(id,100);
				new pName[24];
				new string[265];
				GetPlayerName(playerid,"pName",sizeof(pName));
				format(string,sizeof(string),"MEDIC:You got healed by Medic %s",pName);
				SendClientMessage(id,0x00FF00AA,string);
			}
			else
			{
				SendClientMessage(playerid,0x00FF00AA,"SERVER:You dont have permission to this command!,or yo're ont in an Ambulance!");
			}
		}
		else
		{
			SendClientMessage(playerid, 0xFF0000AA, "Player not found");
		}
	}
	else
	{
		SendClientMessage(playerid, 0xFF0000AA, "SERVER:Usage /heal [ID]");
	}
	return 1;
I wan't it to do this, when e.x a player has 10hp and another player heals he gets 90 = equal to the hp he healed
Reply
#2

pawn Код:
new Float:health, Float:h = 100 - health;
GetPlayerHealth(id,health);

SetPlayerHealth(id, health+h);
Reply
#3

Thanks
Reply
#4

pawn Код:
if(Medic[playerid] == 1 || IsPlayerInVehicle(playerid, 416))
{
    SetPlayerHealth(id,100);
    new pName[24];
    new string[265];
    GetPlayerName(playerid,"pName",sizeof(pName));
    format(string,sizeof(string),"MEDIC:You got healed by Medic %s",pName);
    new Float:health, Float:h = 100 - health;
    GetPlayerHealth(id,health);
    SetPlayerHealth(id, health+h);
    SendClientMessage(id,0x00FF00AA,string);
}
The size of your string is also very unnecessary, like using a hangar for an RC plane.
Reply
#5

lower your string to
pawn Код:
new string[128];
128 cells is more than enough
Reply
#6

ugh 1 more thing, i didn't spell it right... i wan't the healer to get 90$ if he heals 90hp
Reply
#7

Put this below your "MEDIC:You got healed by Medic %s" message:

pawn Код:
GivePlayerMoney(playerid, 90);
You need to change the whole code if you want the ammount healer healed, just make it single ammount, like you get 100 dollars and 1 score for healing a player
Reply
#8

ok brate, ali ja ocu ovako al nema veze hvala u svakom slucaju
Reply
#9

Ok. Talk in english, because you are not allowed to talk other languages here, even tho I do understand you.
Reply
#10

Ai Ai captain
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)