How to make this command?
#9

Try this, untested:

pawn Код:
// top of script

new OfferedHeal[MAX_PLAYERS];
new HealthPrice;
new MedicID, PatientID;
new healedname[24], medicname[24];

// new heal command

CMD:heal(playerid, params[])
{
    if(PlayerInfo[playerid][Job] == 1)
    {
        new string[128];

        if(sscanf(params, "ii", PatientID, HealthPrice)) return SendClientMessage(playerid, -1,"/heal [PlayerID/PlayerName] [Amount]"); // This will actually do it - I is a interget and that's a targetid.

        GetPlayerName(PatientID,healedname,24);
        GetPlayerName(MedicID,medicname,24);

        if(GetPlayerHealth(PatientID) <= 99)
        {
            format(string,128,"Medic  %s (%d) Has Offered You Health Services For  $%d. Type  /acceptheal  To Accept.",medicname,MedicID,HealthPrice);
            SendClientMessage(PatientID,-1,string);
           
            format(string,128,"Offered  %s (%d)  Health Services For $%d.  Wait To See If He Will Respond.",healedname,PatientID,HealthPrice);
            SendClientMessage(MedicID,-1,string);
           
            OfferedHeal[PatientID] = 1;
           
        } else return SendClientMessage(MedicID,-1,"The Target Player's Health Is Already Full.");
    } else return SendClientMessage(MedicID, 0xFFFFFFFF, ".:: Error: You need to be a m3dic to use this command! ::.");
    return 1;
}

// /acceptheal command

CMD:acceptheal(playerid,params[])
{
    if(OfferedHeal[PatientID] == 1)
    {
        new string[128];
       
        SetPlayerHealth(PatientID,100);
       
        format(string,128,"Healed By Medic  %s (%d)  For  $%d.",medicname,MedicID,HealthPrice);
        SendClientMessage(PatientID,-1,string);

        format(string,128,"Healed  %s (%d)  For  $%d.",healedname,PatientID,HealthPrice);
        SendClientMessage(PatientID,-1,string);

        GivePlayerMoney(PatientID, -HealthPrice);
        GivePlayerMoney(MedicID, HealthPrice);
       
        OfferedHealth[PatientID] = 0;
    } else return SendClientMessage(PatientID,-1,"You Weren't Offered Any Medic Services.");
    return 1;
}
Reply


Messages In This Thread
How to make this command? - by PlayHard - 08.12.2011, 18:35
Re: How to make this command? - by Kingunit - 08.12.2011, 18:40
Re: How to make this command? - by PlayHard - 08.12.2011, 18:50
Re: How to make this command? - by Kingunit - 08.12.2011, 18:54
Re: How to make this command? - by PlayHard - 08.12.2011, 18:55
Re: How to make this command? - by bartje01 - 08.12.2011, 20:40
Re : How to make this command? - by Amine_Mejrhirrou - 08.12.2011, 20:49
Re: How to make this command? - by Kingunit - 08.12.2011, 21:00
Re: How to make this command? - by grand.Theft.Otto - 08.12.2011, 21:07
Re: How to make this command? - by PlayHard - 09.12.2011, 09:38

Forum Jump:


Users browsing this thread: 5 Guest(s)