SA-MP Forums Archive
[Help] Loop, loops just once - 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: [Help] Loop, loops just once (/showthread.php?tid=160791)



[Help] Loop, loops just once - Maxips2 - 17.07.2010

This is the loop:
pawn Код:
for(new b = 1; b < sizeof(BizInfo); b++)
it loops just once, and I got no returns/breaks
any ideas?


Re: [Help] Loop, loops just once - XPlatform - 17.07.2010

What's the size of BizInfo?


Re: [Help] Loop, loops just once - Maxips2 - 17.07.2010

MAX_BIZ/250
pawn Код:
#define MAX_BIZ 250



Re: [Help] Loop, loops just once - XPlatform - 17.07.2010

So if BizInfo is MAX_BIZ/250, and MAX_BIX is 250, then 250/250 is 1.

You only have one loop because your loop is basically like this:

pawn Код:
for(new b = 1; b < 1; b++)
Though I think that shouldn't loop at all...


Re: [Help] Loop, loops just once - Maxips2 - 17.07.2010

If what you're saying is right, so what to do? o_O


Re: [Help] Loop, loops just once - XPlatform - 17.07.2010

First; why are you dividing MAX_BIZ by 250 when declaring BizInfo?

(I assume you have this or something similar somewhere in your code)
pawn Код:
new BizInfo[MAX_BIZ/250];
If you can answer that, then you can fix the problem...

Because that would only give you 1 possible biz. If you want more, you'd be better off makeing it look like this:

pawn Код:
new BizInfo[MAX_BIZ];
That will give you the full 250 biz's your looking for.


Re: [Help] Loop, loops just once - Maxips2 - 17.07.2010

pawn Код:
enum bInfo
{
    Float:bEntrancex,
    Float:bEntrancey,
    Float:bEntrancez,
    Float:bExitx,
    Float:bExity,
    Float:bExitz,
    bInt,
    bWorld,
    bPickup,
    bOwned,
    bOwner[MAX_PLAYER_NAME],
    Text3D:bLabel,
    bPrice,
    bName[256],
    bLocation[256],
    bTill,
    bProds,
    bType,
    bLock
}
new BizInfo[MAX_BIZ][bInfo];
Theres nothing wrong here, and it was this way before


Re: [Help] Loop, loops just once - XPlatform - 17.07.2010

I am confused now; you said the size of BizInfo was MAX_BIZ/250...

Try changing

pawn Код:
for(new b = 1; b < sizeof(BizInfo); b++)
to

pawn Код:
for(new b = 1; b < MAX_BIZ; b++)



Re: [Help] Loop, loops just once - Maxips2 - 17.07.2010

Still the same


Re: [Help] Loop, loops just once - XPlatform - 17.07.2010

Well, now I'm lost now to be honest.

If you want I could help you via msn or teamviewer; pm me if you want to do so.