healing if in ambulance
#1

ive been thinking about this, would it be posible to heal a player if they are near or in a ambulance?

here is what i have so far

Код:
	if(strcmp(cmd, "/med", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1) // faction id 1 (medic)
			{
			  tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /med [playerid]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
			  if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
					new Float:HP;
				    GetPlayerHealth(playerid,HP);
                    if(HP < 100
					  {
					    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already healed");
					    return 1;
					  }
					// something here
						{
						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't heal yourself"); return 1; }
    					format(string, sizeof(string), "[INFO:] Healed by %s.", GetPlayerNameEx(playerid));
							SendClientMessage(giveplayerid, COLOR_LIGHTYELLOW2, string);
							format(string, sizeof(string), "[INFO:] %s successfully Healed.", GetPlayerNameEx(giveplayerid));
							SendClientMessage(playerid, COLOR_WHITE, string);
							PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just Healed");
						}
						else
						{
						  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!");
						  return 1;
						}
					}
				}
				else
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
				  return 1;
				}
			}
im not sure if im even close to be right atm anyone help?
Reply
#2

Quote:
Originally Posted by [LCG
TANKER ]
ive been thinking about this, would it be posible to heal a player if they are near or in a ambulance?

here is what i have so far

Код:
	if(strcmp(cmd, "/med", true) == 0)
	{
	  if(IsPlayerConnected(playerid))
	  {
			if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1) // faction id 1 (medic)
			{
			  tmp = strtok(cmdtext, idx);
				if(!strlen(tmp)) {
					SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /med [playerid]");
					return 1;
				}
				giveplayerid = ReturnUser(tmp);
			  if(IsPlayerConnected(giveplayerid))
				{
				  if(giveplayerid != INVALID_PLAYER_ID)
				  {
					new Float:HP;
				    GetPlayerHealth(playerid,HP);
                    if(HP < 100
					  {
					    SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That person is already healed");
					    return 1;
					  }
					// something here
						{
						  if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can't heal yourself"); return 1; }
    					format(string, sizeof(string), "[INFO:] Healed by %s.", GetPlayerNameEx(playerid));
							SendClientMessage(giveplayerid, COLOR_LIGHTYELLOW2, string);
							format(string, sizeof(string), "[INFO:] %s successfully Healed.", GetPlayerNameEx(giveplayerid));
							SendClientMessage(playerid, COLOR_WHITE, string);
							PlayerPlayerActionMessage(playerid,giveplayerid,15.0,"has just Healed");
						}
						else
						{
						  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] That player is not near you!");
						  return 1;
						}
					}
				}
				else
				{
				  SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid ID.");
				  return 1;
				}
			}
im not sure if im even close to be right atm anyone help?
/FACEPALM...

Ask in the Carlito RP Script....

God.. Now its not going to be Ask in the GodFather thread, its gonna be Ask in the Carlito RP script...
Reply
#3

?
Reply
#4

Not quite sure this is possible

ALSO, this does not have to be asked in the CRP thread, I do not think. It is a general snippet that is to be added to CRP and uses CRP's DynamicFaction
Reply
#5

It is possible that you can heal them inside the ambulance, but not anywhere near it.
Reply
#6

@ Bruzer18

my script has nothing to due with Carlito script except for the dynamic factions and i dont even want to go there with GF script i got to screwed over with the creater of it
Reply
#7

ok... i got most of it all sorted out now but for some reason it dosent seam to work as well. anyone can do /heal but it wont acculy work it will only show this [INFO:] /heal [playerid/PartOfName] ,im not sure what is holding it up now

pawn Код:
if(strcmp(cmd, "/heal", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
      if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 2)
      {
                giveplayerid = ReturnUser(tmp);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[INFO:] /heal [playerid/PartOfName]");
            return 1;
        }
        tmp = strtok(cmdtext, idx);
        if (giveplayerid == playerid)
                {
            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] You can not heal yourself!");
            return 1;
        }
        if(giveplayerid != INVALID_PLAYER_ID)
        {
            new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new giveambu = GetPlayerVehicleID(giveplayerid);
            new playambu = GetPlayerVehicleID(playerid);
            {
            if (IsAnAmbulance(playambu) && playambu == giveambu)
            {
                new Float:tempheal;
                GetPlayerHealth(giveplayerid,tempheal);
                if(tempheal >= 100.0)
                {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2," [ERROR:]That person is fully healed.");
                return 1;
                }
                GameTextForPlayer(playerid, string, 5000, 1);
                new hp = 100;
                SetPlayerHealth(giveplayerid, 100);
                format(string, sizeof(string), "[INFO:]You have been healed to %d health",hp);
                SendClientMessage(giveplayerid, COLOR_LIGHTYELLOW2,string);
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[INFO:]One of you is not in the Ambulance / Chopper!");
                return 1;
            }
            }
        }
        else
        {
            format(string, sizeof(string), "[ERROR:]%d is not an active player.", giveplayerid);
            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
                }
      }
      else
        {
            SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Invalid Faction.");
            return 1;
        }
    }
    return 1;
  }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)