Array index is out of bounds
#6

Just return an error message that the player is not near at any house:
pawn Код:
new i = IsPlayerNearHouse(playerid);
if (i == -1) return SendClientMessage(...);
and it'll be fine.

Quote:
Originally Posted by R0
Посмотреть сообщение
dont return 1,change IsPlayerNearHouse to:
pawn Код:
stock IsPlayerNearHouse(playerid)
{
    for(new i = 1; i < MAX_HOUSES; i++)
    {
        if(HouseIDTaken[i] && IsPlayerInRangeOfPoint(playerid, 1.0, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ])) return i;
    }
    return 0;
}
and change other loops that are like this:
pawn Код:
for(new i = 0; i < MAX_HOUSES; i++)
to:
pawn Код:
for(new i = 1; i < MAX_HOUSES; i++)
I see no reason on doing that like this.
Reply


Messages In This Thread
Array index is out of bounds - by RenSoprano - 22.04.2015, 19:06
Re: Array index is out of bounds - by R0 - 22.04.2015, 19:22
Re: Array index is out of bounds - by Sithis - 22.04.2015, 19:22
Re: Array index is out of bounds - by RenSoprano - 22.04.2015, 19:27
Re: Array index is out of bounds - by R0 - 22.04.2015, 19:42
Re: Array index is out of bounds - by Konstantinos - 22.04.2015, 19:53
Re: Array index is out of bounds - by RenSoprano - 22.04.2015, 19:53

Forum Jump:


Users browsing this thread: 1 Guest(s)