[HELP] /heal command
#1

Hello everyone how can I make heal command so if my house have heal upgrade then when I type just in my house /heal then I'm healed but when I'm outside of the house and type heal then I want that it say /heal [Userid] [price] this is for hospital(medical department) member I try but it doesn't work. Please help. Thanks

pawn Код:
CMD:heal(playerid, params[])
{
    new location = PlayerInfo[playerid][pPhousekey1],string[128],sendername[MAX_PLAYER_NAME];
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(location != 255)
    {
        if(KucaInfo[location][hArm] == 1 && IsACop(playerid))
        {
            TogglePlayerControllable(playerid, 0);
            GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
            Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
            Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
            SetPlayerPos(playerid,1527.5,-12.1,1002.0);
            PlayerInfo[playerid][pLocal] = 255;
            SetPlayerInterior(playerid,99);
            Spectate[playerid] = 257;
            return 1;
        }
        if(KucaInfo[location][hHel] == 1)
        {
            new Float:tempheal;
            GetPlayerHealth(playerid,tempheal);
            if(tempheal < 99.0)
            {
                SetPlayerHealth(playerid,99.0);
                format(string, sizeof(string),"*Izljeceni ste na 100 zdravlja.");
                SendClientMessage(playerid, BELA,string);
            }
            else SendClientMessage(playerid, SIVA,"Vec ste izljeceni na 100.");
            return 1;
        }
        if(KucaInfo[location][hHel] != 1 && (KucaInfo[location][hArm] != 1 || !IsACop(playerid))) SendClientMessage(playerid, SIVA,"Ovo mjesto nema ni heal upgrade ni zastitne upgrade.");
        else if(KucaInfo[location][hHel] != 1) SendClientMessage(playerid, SIVA,"Ovo mjesto nema heal upgrade.");
        else if(KucaInfo[location][hArm] != 1 || !IsACop(playerid)) SendClientMessage(playerid, SIVA,"Ovo mjesto nema zastitne upgrade.");
    }
    new id, cena, hIme[2][MAX_PLAYER_NAME], Float:Poz[2][3];
    if(sscanf(params,"ui[128]", id, cena)) return SCM(playerid, GRAD3,"{FFAF00}Koristite: {FFFFFF}/heal [Korisnicki ID ili Ime Korisnika] [Cijena lijecenja]");
    if(!IsPlayerConnected(id)) return SCM(playerid, GRAD2,"{F81414}[Greska!] {C3C3C3}Taj igrac je offline!");
    if(!IgracUMD(playerid)) return SCM(playerid, GRAD2,"{F81414}[Greska!] {C3C3C3}Niste ovlasteni za koristenje ove komande!");
    GetPlayerPos(playerid, Poz[0][0], Poz[0][1], Poz[0][2]);
    GetPlayerPos(id, Poz[1][0], Poz[1][1], Poz[1][2]);
    if(GetDistanceBetweenPoints(Poz[0][0], Poz[0][1], Poz[0][2], Poz[1][0], Poz[1][1], Poz[1][2]) > 5.0 || IgracNaReconu[id] == true) return SCM(playerid, GRAD2,"{F81414}[Greska!] {C3C3C3}Predaleko ste!");
    if(IsPlayerInAnyVehicle(playerid) && !IsPlayerInAnyVehicle(id)) return SCM(playerid, GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Morate izaci iz vozila.");
    if(!IsPlayerInAnyVehicle(playerid) && IsPlayerInAnyVehicle(id)) return SCM(playerid, GRAD2,"{F81414}(Odbijeno!) {C3C3C3}igrac je u vozilu!");
    if(GetPlayerVehicleID(id) != GetPlayerVehicleID(playerid)) return SCM(playerid, GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Taj igrac nije u Vasem vozilu!");
    if(cena < 0) return SCM(playerid, GRAD2,"**Cijena mora biti veca od $0!");
    if(cena > 500) return SCM(playerid, GRAD2,"**Cijena mora biti manja od $500!");
    if(PlayerInfo[id][pCash] < cena) return SCM(playerid, GRAD2,"{F81414}(Odbijeno!) {C3C3C3}Taj igrac nema toliko novca!");
    hLecenjeOd[id] = playerid; hCenaLecenja[id] = cena;
    RPIme(playerid, hIme[0]); RPIme(id, hIme[1]);
    SCMF(playerid, SVETLOPLAVA,"* Ponudili ste lijecenje igracu %s za $%d.", hIme[1], cena);
    SCMF(id, SVETLOPLAVA,"* Bolnicar %s Vam je ponudio lijecene po cijeni od $%d. Da prihvatite upisite /prihvati lijecenje.", hIme[0], cena);
    return 1;
}
Reply
#2

anyone
Reply
#3

What exactly is the problem with it?

Also, replace this over your sscanf line.
pawn Код:
if(sscanf(params,"ui[128]", id, cena)) return SCM(playerid, GRAD3,"{FFAF00}Koristite: {FFFFFF}/heal [Korisnicki ID ili Ime Korisnika] [Cijena lijecenja]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)