Switch, cases & returns.
#1

Hey, this codes' been bugging me for a bit now. Here's a little detail: My business system needs products for items to be bought, now, so the business i'm buying from has 0 products, OK, but i'm still able to buy the item, it says:
Quote:
Originally Posted by Text
[Error]: This store has no products
but then it still shows the menu of what item i'd like to buy. Can someone check this out..

pawn Код:
command(buy, playerid, params[]) {
    new stringformat[128];
    for(new i = 0; i < TOTAL_BUSINESSES; i ++ ) {
      if(IsPlayerInRangeOfPoint(playerid, 55.0, BizData[i][bExPos][0],BizData[i][bExPos][1],BizData[i][bExPos][2])) {
        if(BizData[i][bProducts] < 1) return SendClientMessage(playerid, COLOR_SYSTEM, "[Error]: This store has no products.");
                  switch(BizData[i][bType]) {
                        case 0: {
                    // The rest of the code doesn't need to be shown, but you get the process, it goes to the cases even thought I returned the message and the products are 0
I tried using return 0 and ignoring the message and return 1, but the same effect.
Reply


Messages In This Thread
Switch, cases & returns. - by Carlton - 17.06.2010, 16:18
Re: Switch, cases & returns. - by Mike_Peterson - 17.06.2010, 19:06
Re: Switch, cases & returns. - by NewTorran - 17.06.2010, 19:19
Re: Switch, cases & returns. - by Carlton - 17.06.2010, 22:57

Forum Jump:


Users browsing this thread: 2 Guest(s)