Jump to content
  • 0

Problema lictiatii


Andrei-Madalin Hizan

Question

cum pot face ca la licitatiile sa vina random, nu doar id 1 la case pana cineva o castiga la lictiatie pe urma vine urmatoarea, vreau sa vina random casele care nu au owner... daca intelegeti..

am asa facut, aveti idee?



function FreeHouses() {
    new x;
    for(new i = 1; i < sizeof(HouseInfo); i++) {
        if(strcmp(HouseInfo[i][hOwner], "The State", true) == 0 && HouseInfo[i][hOwned] == 1) x++;
    }
    return x;
}
function GetHouseID() {
    for(new i = 1; i < sizeof(HouseInfo); i++) {
        if(strcmp(HouseInfo[i][hOwner], "The State", true) == 0 && HouseInfo[i][hOwned] == 1) return i;
    }
    return false;
}

if(FreeHouses() > 0) {
                            new id = GetHouseID();
                            Licitatie = 1;
                            TipLicitatie = 1;
                            TimpLicitatie = 5*60;
                            TotalBani = 0;
                            foreach(Player, i) {
                                if(IsPlayerConnected(i) && IsPlayerLogged[i] == 1) TotalMoney[i] = 0;
                            }
                            IDLicitatie = id;
                            LastPlayer = -1;

                            foreach(Player, i) {
                                if(IsPlayerConnected(i) && toglicitatie[i] == 0) {
                                    SCM(i, COLOR_YELLOW, "O licitatie tocmai a inceput. Optiunea de a vedea mesajele de la licitatie este dezactivata.");
                                    SCM(i, COLOR_YELLOW, "Daca vrei sa vezi mesajele, foloseste comanda /tog iar daca vrei sa vezi pentru ce se liciteaza, foloseste /info.");
                                }
                            }
                            
                            MesajLicitatie(0x7A45FFFF, "O noua licitatie tocmai a inceput!");
                            switch(TipLicitatie) {
                                case 1: format(string, sizeof(string), "De data aceasta, se liciteaza pentru casa cu ID-ul %d. (/findhouse %d). ", id, id);
                                case 2: format(string, sizeof(string), "De data aceasta, se liciteaza pentru afacerea cu ID-ul %d. (/findbiz %d). ", id, id);
                            }
                            MesajLicitatie(0x7A45FFFF, string);
                            format(string, sizeof(string), "Ai la dispozitie 5 minute pentru a licita.");
                            MesajLicitatie(0x7A45FFFF, string);
                            MesajLicitatie(0x7A45FFFF, "Comenzi disponibile: (/bid - licitezi), (/info - informatii)");
                        }            
                        else if(minute == 0 && second == 0) SendAdminMessage(COLOR_WHITE, "AdmBot: Nu sunt proprietati ce poti fi scoase la licitatie.", 1);
                    }

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Ai putea sa faci un iterator unde sa stockezi toate casele care nu ai un owner si la FreeHouses la for(new ... sa fie bagate in iterator

si in loc de if(FreeHouses() > 0) va trebuie sa fie if(Iter_Count(numeIterator) > 0)
si la  new id = GetHouseID(); va trebuie sa fie new id = Iter_Random(numeIterator);

Nu stiu daca am explicat bine, dar cred ca intelegi daca nu add pe discord: iSorin[]#8855

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.