i need one MEDIC class help
#1

Код:
CMD:heal(playerid, params[])
{
	if(gClass[playerid] == MEDIC)
	{
	  new Float:health, targetid;
	  if(sscanf(params, "i", targetid)) return SendClientMessage(playerid, grey, "Syntax: /heal [playerid]");
	  GetPlayerHealth(targetid, health);
	  if(targetid == playerid) return SendClientMessage(playerid,red," You cannot heal yourself");
	  if(health >= 80) return SendClientMessage(playerid, red, "Player, have enough health to survive.");
	  SendClientMessage(targetid, red, "You have just been healed!");
	  SendClientMessage(playerid, red, "HEALED 20%");
	  SetPlayerHealth(targetid, health + 20);

	}
	else return SendClientMessage(playerid,-1,"You Are Not An Medic!");
	return 1;
}
i want if someone heal other team members it send message, you cant heal other team players
Reply
#2

Код:
CMD:heal(playerid, params[])
{
	if(gClass[playerid] == MEDIC)
	{
	  new Float:health, targetid;
	  if(sscanf(params, "i", targetid)) return SendClientMessage(playerid, grey, "Syntax: /heal [playerid]");
	  GetPlayerHealth(targetid, health);
	  if(targetid == playerid) return SendClientMessage(playerid,red," You cannot heal yourself");
          if(gTeam[playerid] != gTeam[targetid]) return SendClientMessage(playerid, red, "You cannot heal an opposing team member!"); //added line. Change gTeam to team variable.
	  if(health >= 80) return SendClientMessage(playerid, red, "Player, have enough health to survive.");
	  SendClientMessage(targetid, red, "You have just been healed!");
	  SendClientMessage(playerid, red, "HEALED 20%");
	  SetPlayerHealth(targetid, health + 20);

	}
	else return SendClientMessage(playerid,-1,"You Are Not An Medic!");
	return 1;
}
Try that out, I commented next to the line I added.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)