CheckPlayerHealt?
#1

Hello!

With this cmd you can heal players if you both are in a ambulance, you can do it over and over again even if the players health is 100.
So how can i do a player health check so you cant abuse the cmd?
i guess the check would look something like this?
Код:
CheckplayerHealth(playerid, 100);
     SetPlayerHealth(giveplayerid, 100);

Код:
	if(strcmp(cmd, "/Heal", true) == 0)
	{
	  if(Medic(playerid))
	  {
	    new tmpcar = GetPlayerVehicleID(playerid);
	    if(MedicCar(tmpcar))
	    {
	    	tmp = strtok(cmdtext, idx);
	    	if(!strlen(tmp))
	    	{
	      	SCM(playerid, COLOR_WHITE, "USAGE: /Heal <Player ID>");
	      	return 1;
				}
				new giveplayerid = ReturnUser(tmp);
				if(giveplayerid == playerid)
				{
				  SCM(playerid, COLOR_RED, "MAIN ERROR(You can't heal yourself!)");
				  return 1;
				}
				if(IsPlayerConnected(giveplayerid))
				{
			  	if(tmpcar == GetPlayerVehicleID(giveplayerid))
					{
					  GetPlayerName(playerid, UserName, sizeof(UserName));
					  GetPlayerName(giveplayerid, UserName2, sizeof(UserName2));
					  SetPlayerHealth(giveplayerid, 100);
					  format(Text, sizeof(Text), "** You got healed by medic %s! **", UserName);
					  SCM(giveplayerid, COLOR_GREEN, Text);
					  format(Text, sizeof(Text), "** You healed %s and earned $750! **", UserName2);
					  SCM(playerid, COLOR_GREEN, Text);
					  GivePlayerMoney(playerid, 750);
					}
					else{SCM(playerid, COLOR_RED, "MAIN ERROR(That person isn't in you'r ambulance!)");}
				}
				else{SCM(playerid, COLOR_RED, "MAIN ERROR(That player is offline!)");}
			}
			else{SCM(playerid, COLOR_RED, "MAIN ERROR(You are not in an ambulance!)");}
		}
		else{SCM(playerid, COLOR_RED, "MAIN ERROR(You are not a medic)");}
		return 1;
	}
Reply
#2

GetPlayerHealth?
Reply
#3

pawn Код:
new Float:health;
GetPlayerHealth(giveplayerid,health);
if(health >= 100.0)
{
    SendClientMessage(playerid, COLOR_GREY,"That person is fully healed.");
    return 1;
}
Something like this? Or what?
Reply
#4

Quote:
Originally Posted by chosen
pawn Код:
new Float:health;
GetPlayerHealth(giveplayerid,health);
if(health >= 100.0)
{
    SendClientMessage(playerid, COLOR_GREY,"That person is fully healed.");
    return 1;
}
Something like this? Or what?
yes something like that. if the player in the ambulance have fully health the medic get that message and do not get any money and does not heal him.
but i dont know in witch line to put it to work
Reply
#5

Put it above this line
pawn Код:
SetPlayerHealth(giveplayerid, 100);
Reply
#6

Quote:
Originally Posted by chosen
Put it above this line
pawn Код:
SetPlayerHealth(giveplayerid, 100);
Yes that was what i did..just have to wait for my friend to logg on to test it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)