Dialog + Loop problem
#10

index just represents the index of the SystemShop

I just subtract the line count and if listitem gets negative we found our index

pawn Код:
if(!(listitem & (1 << (cellbits - 1)))) {} // this can also be written like
if(0 <= listitem) {}
the do, just because the first while check would be unnecessary

pawn Код:
// indention
    if(dialogid == 72)
    {
        if(!response) return 1;

        new string[500], index;
        do
        { // not sure if you can remove the brackets here, so i let them
            listitem -= (ServerShop[index][shop_unlocked][playerid]) ? (2) : (3);
        } while(!(listitem & (1 << (cellbits - 1))) && (++index != sizeof ServerShop));
       
        if(ServerShop[index][shop_unlocked][playerid] == 0)
            return SendClientMessage(playerid,COLOR_RED,"*You cannot buy shop items twice!");
        if(ServerShop[index][shop_costmoney] > GetPlayerMoney(playerid) && ServerShop[index][shop_unlocked[playerid][playerid]==1)
            return SendClientMessage(playerid,COLOR_RED,"*You either do not have enough score or money for this item!");
    }
Reply


Messages In This Thread
Dialog + Loop problem - by knackworst - 15.10.2011, 14:01
Re: Dialog + Loop problem - by Josma_cmd - 15.10.2011, 14:07
Re: Dialog + Loop problem - by knackworst - 15.10.2011, 14:12
AW: Dialog + Loop problem - by Nero_3D - 15.10.2011, 15:27
Re: Dialog + Loop problem - by knackworst - 15.10.2011, 15:41
AW: Dialog + Loop problem - by Nero_3D - 15.10.2011, 15:57
Re: Dialog + Loop problem - by knackworst - 15.10.2011, 16:02
AW: Dialog + Loop problem - by Nero_3D - 15.10.2011, 16:41
Re: Dialog + Loop problem - by knackworst - 15.10.2011, 16:56
AW: Re: Dialog + Loop problem - by Nero_3D - 15.10.2011, 17:33

Forum Jump:


Users browsing this thread: 1 Guest(s)