SA-MP Forums Archive
Array index out of bound? - 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)
+--- Thread: Array index out of bound? (/showthread.php?tid=423077)



Array index out of bound? - Da_Noob - 16.03.2013

Oke, I thought it was solved after somebody mentioned a closing ')', but it's not.

Code:

pawn Код:
for(new biz = 0; biz < MAX_BIZ; biz++) // For entering a business
    {
        if(IsPlayerInRangeOfPoint(playerid, 2, BizInfo[biz][XCoord], BizInfo[biz][YCoord], BizInfo[ZCoord]) && PlayerInfo[playerid][pVW] == 0) // ERROR ON THIS LINE
        {
            new string25[150];
            format(string25,sizeof(string25),"Welcome to %s!", BizInfo[biz][Name]);
            SetPlayerVirtualWorld(playerid, BizInfo[biz][VW]);
            PlayerInfo[playerid][pVW] = BizInfo[biz][VW];
            PlayerInfo[playerid][pInt] = BizInfo[biz][VW];
            PlayerInfo[playerid][pLocal] = BizInfo[biz][VW];
            SetPlayerInterior(playerid, BizInfo[biz][Int]);
            SetPlayerPos(playerid, BizInfo[biz][IXCoord], BizInfo[biz][IYCoord], BizInfo[biz][IZCoord]);
            SendClientMessage(playerid, COLOR_LIGHTGREEN, string25);
        }
    }
My errors:

Код:
C:\Program Files\GTA San Andreas (2)\server\FGRP\gamemodes\FGRP - Copy.pwn(36668) : error 032: array index out of bounds (variable "BizInfo")
C:\Program Files\GTA San Andreas (2)\server\FGRP\gamemodes\FGRP - Copy.pwn(89426) : warning 203: symbol is never used: "IsAtAMMU"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Tried to change MAX_BIZ as somebody said, but that didn't work.


Re: Array index out of bound? - Tumba - 16.03.2013

Your MAX_BIZ is too short, increase it.


Re: Array index out of bound? - [ABK]Antonio - 16.03.2013

You forgot the closing parenthesis in the IsPlayerInRangeOfPoint


Re: Array index out of bound? [SOLVED] - Da_Noob - 16.03.2013

No luck. Changed it way too high, but still the error. Normally I set it to 100 and it worked fine on my other script. But when I'm implenting it to my main script I get that error.

EDIT: omfg, I'm so stupid. Thank you.
EDIT2: lol, I thought it was fixed by adding the ')', but it's not. HELP!
EDIT3: I'm a retard. I've put BizInfo[ZCoord] instead of BizInfo[biz][ZCoord]. Solved!


Re: Array index out of bound? - P3DRO - 16.03.2013

change this:
Код:
BizInfo[biz][YCoord], BizInfo[ZCoord]
to:
Код:
BizInfo[biz][YCoord], BizInfo[biz][ZCoord]