15.10.2011, 17:33
index just represents the index of the SystemShop
I just subtract the line count and if listitem gets negative we found our index
the do, just because the first while check would be unnecessary
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) {}
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!");
}

