SA-MP Forums Archive
For - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: For (/showthread.php?tid=274349)



For - [IL]HeHu - 05.08.2011

PHP код:
                ForLoop(i,5)
                {
                    if(
HouseInfo[HouseID[playerid]][hItem][i] == 0HouseInfo[HouseID[playerid]][hItem][i] = 2;
                    
printf("Item ID: %i | Item type: %i",iHouseInfo[HouseID[playerid]][hItem][i]);
                    break;
                   } 
This just prints 0 and 1, but as you can see it is supposed to print 1 and 2
Because in the MySQL slot 0 is taken, but it doesn't see it as taken.
Can you see any problems in this code?


Re: For - MadeMan - 05.08.2011

I think it should be like this:

pawn Код:
ForLoop(i,5)
                {
                    if(HouseInfo[HouseID[playerid]][hItem][i] == 0)
                    {
                        HouseInfo[HouseID[playerid]][hItem][i] = 2;
                        printf("Item ID: %i | Item type: %i",i, HouseInfo[HouseID[playerid]][hItem][i]);
                        break;
                    }
                }