I have a question
#4

Thanks IsBack but now working rate please? someone try it for me(i can test it right now)

pawn Код:
COMMAND:heal(playerid,params[])
{
    if(gTeam[playerid] == TEAM_MEDICS)
    {
       new p1;
       new p2;
       new Float:health;
       if(sscanf(params,"u",p2)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /heal [id]");
       else if(!IsPlayerConnected(p2)) return SendClientMessage(playerid, COLOR_RED, "This player is not connected");
       else if(p2 == playerid) return SendClientMessage(playerid,COLOR_RED,"You cannot heal yourself");
       GetPlayerHealth(p2,health);
       if(health < 80)
       {
         GetDistanceBetweenPlayers(p1,p2);
         if(GetDistanceBetweenPlayers(p1,p2) > 5) return SendClientMessage(p1,COLOR_RED,"Player is too far away");
         if(GetDistanceBetweenPlayers(p1,p2) < 5)
         {
             GetPlayerMoney(p2);
             if(GetPlayerMoney(p2) > 500)
             {
                SetPlayerHealth(p2,100);
                GivePlayerMoney(p2,-500);
                GivePlayerMoney(p1,500);
                new medicname[24];
                new injuriedname[24];
                GetPlayerName(p1,medicname,sizeof(medicname));
                GetPlayerName(p2,injuriedname,sizeof(injuriedname));
                new string[128];
                format(string,sizeof(string),"Player %s has been healed by medic %s",injuriedname,medicname);
                SendClientMessageToAll(COLOR_PURPLE,string);
             }
             if(GetPlayerMoney(p2) < 500) return SendClientMessage(p1,COLOR_YELLOW,"The player doesn't have enough money");
         }
        if(health > 80) return SendClientMessage(playerid,COLOR_GREEN,"The player doesn't need to be healed");
      }
    }
    if(gTeam[playerid] == TEAM_COPS || gTeam[playerid] == TEAM_ROBBERS || gTeam[playerid] == TEAM_FIREFIGHTERS) return SendClientMessage(playerid,COLOR_RED,"This command is only for medics.");
  return true;
}
Reply


Messages In This Thread
I have a question - by Cjgogo - 17.05.2011, 15:44
Re: I have a question - by *IsBack - 17.05.2011, 15:47
Re: I have a question - by Alby Fire - 17.05.2011, 15:49
Re: I have a question - by Cjgogo - 17.05.2011, 16:03

Forum Jump:


Users browsing this thread: 1 Guest(s)