Medic Class
#1

Hey guys. i want class that will known as medic. With this class you can heal yourself. You can type /heal to heal your self. You can only heal 30 hp once before die.. Than you can't use it. And can use it after die...

Please make it for me please..
Reply
#2

Is this what you wanted? Or did you want to make it so if you did /heal [playerid][amount], it would give them the amount, but it would count up the amount until the amount hits 30, in which case you couldn't use the command anymore.

pawn Код:
new Class[MAX_PLAYERS];
new AlreadyHealed[MAX_PLAYERS];

Class[playerid] == 2; //Lets say 2 is the medic class
AlreadyHealed[playerid] == 0;  //Place this where you become the class, and when you die.

CMD:heal(playerid, params[])
{
    if(Class[playerid] == 2)
    {
        new targetid;
        if(sscanf(params, "u", targetid) return SendClientMessage(playerid, -1, "Usage: /heal [playerid] (heals 30 hp)");
        if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1, "That player is not connected!");
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(targetid, health);
            if(health <= 70) SetPlayerHealth(targetid, health + 30.0);
            else SetPlayerHealth(targetid, 100); //This wouldn't be efficient if you have a godmode command or something, though
            AlreadyHealed[playerid] == 1;
        }
        else return SendClientMessage(playerid, -1, "You already healed someone!");
    }
    else return SendClientMessage(playerid, -1, "You are not a medic!");
    return 1;
}
Reply
#3

pawn Код:
CMD:heal(playerid, params[])
{
      if pTeam[playerid] = TEAM_MEDIC;
      new Float:health;
      GetPlayerHealth(playerid,health);
      SetPlayerHealth(playerid, health+30);
}
Don't know your variables, sorry about them identation, on my phone
Reply
#4

i want to heal my self bro... Like cxnnor. but we can heal once then we can't. But we can if we die..
Reply
#5

pawn Код:
CMD:heal(playerid, params[])
{
    if(Class[playerid] == TEAM_MEDIC)
    {
        if(AlreadyHealed[playerid] == 0)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health <= 70) SetPlayerHealth(playerid, health + 30);
            else SetPlayerHealth(playerid, 100); //Prevents health going above 100.  If you want to enable  this, remove this line and the if statement above.
        }
        else return SendClientMessage(playerid, -1, "You must die first before you can heal again!");
    }
    else return SendClientMessage(playerid, -1, "You are not a medic!");
}
Like this. I already created the variables I included here in my above post.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)