Array index out of bounds
#4

Just leave these brackets empty if you use a predefined array
if you still get an error than you did something wrong afterwards
pawn Код:
new Float:InteriorCoords[][] =  {};
The problem is that you start with 1 in the second dimension, it should be
pawn Код:
SetPVarFloat(playerid,"HouseExitX", InteriorCoords[0][0]);
SetPVarFloat(playerid,"HouseExitY", InteriorCoords[0][1]);
SetPVarFloat(playerid,"HouseExitZ", InteriorCoords[0][2]);
If your line is to long you could place it on an extra line
pawn Код:
ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "Houses",
    "Small Cottage\nLight Living\nDirty Laundry\nFancy Apartment\nHouse Ghetto Small\nGhetto Project Apartment Small\nLS Trailer\nLong John\nApartment Near Beach Medium\nHuge House at Vinewood\nMedium House at SF\nSmall Project LV\nHallway House\nLight Apartment\nSmall Nice House in SF\nUgly but big\nShithole\nMinor Manor\nPink house in SF\n3 Story Condo in SF\n4 Story Condo in SF\nMajor Manor\nMexican Style House\nSimple House\nMadd Doggs House",
    "Accept", "Cancel"
);
The line limit is around ~500 char, this will only raise it by a little

For really longs strings you should define them globally

pawn Код:
// strings must be placed right after each other
new
    DialogText1[] = "Small Cottage\nLight Living\nDirty Laundry\nFancy Apartment\nHouse Ghetto Small\nGhetto Project Apartment Small\nLS Trailer\nLong John\nApartment Near Beach Medium\nHuge House at Vinewood\nMedium House at SF\nSmall Project LV",
    DialogText2[] = "Hallway House\nLight Apartment\nSmall Nice House in SF\nUgly but big\nShithole\nMinor Manor\nPink house in SF\n3 Story Condo in SF\n4 Story Condo in SF\nMajor Manor\nMexican Style House\nSimple House\nMadd Doggs House"
);
// OnGameModeInit
    // You could also write a simple function to conect these strings
    DialogText2[sizeof DialogText2 - 1] = EOS; // this is necessary otherwise the compiler will ignore it as it is never used
    DialogText1[sizeof DialogText1 - 1] = '\n'; // concact both strings with '\n' (we left that one away at the end of the first string)
// Your dialog
    ShowPlayerDialog(playerid, 123, DIALOG_STYLE_LIST, "Houses", DialogText1, "Accept", "Cancel");
Reply


Messages In This Thread
Array index out of bounds - by Glenn332 - 01.03.2015, 16:38
Re: Array index out of bounds - by abyss. - 01.03.2015, 16:47
Re: Array index out of bounds - by Glenn332 - 01.03.2015, 17:01
AW: Array index out of bounds - by Nero_3D - 01.03.2015, 18:05
Re: AW: Array index out of bounds - by Glenn332 - 01.03.2015, 18:58
Re: Array index out of bounds - by ball - 01.03.2015, 19:33
Re: Array index out of bounds - by Glenn332 - 01.03.2015, 20:05
Re: Array index out of bounds - by ball - 01.03.2015, 20:35
Re: Array index out of bounds - by Glenn332 - 01.03.2015, 20:53

Forum Jump:


Users browsing this thread: 1 Guest(s)