invalid subscript -
Vizi - 24.08.2012
Can somebody help me with this?
pawn Код:
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69620) : error 028: invalid subscript (not an array or too many subscripts): "YSI_gAwheelmodels"
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69620) : warning 215: expression has no effect
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69620) : error 001: expected token: ";", but found "]"
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69620) : error 029: invalid expression, assumed zero
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69620) : fatal error 107: too many error messages on one line
Line
pawn Код:
iswheelmodel(modelid) {
new wheelmodels[17] = {1025,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1096,1097,1098};
foreach(wheelmodels, I) { // THE LINE
if (modelid == wheelmodels[I])
return true;
}
return false;
}
Re: invalid subscript -
[MWR]Blood - 24.08.2012
pawn Код:
for(new I = 0; I < sizeof(wheelmodels); ++I)
Re: invalid subscript -
Vizi - 24.08.2012
Same bro :S
Re: invalid subscript -
Misiur - 24.08.2012
pawn Код:
stock iswheelmodel(modelid) {
new wheelmodels[17] = {1025,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1096,1097,1098};
for(new i = 0; i < sizeof(wheelmodels); ++i) {
if (modelid == wheelmodels[i]) return true;
}
return false;
}
If your code looks like this, there shouldn't be any errors
Re: invalid subscript -
Vizi - 24.08.2012
now this :@
pawn Код:
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69629) : error 017: undefined symbol "YSI_gSillegalvehs"
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69629) : error 017: undefined symbol "YSI_gAillegalvehs"
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69629) : warning 215: expression has no effect
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69629) : error 001: expected token: ";", but found "]"
F:\Users\Daniel\Desktop\GCRP\gamemodes\GCRP.pwn(69629) : fatal error 107: too many error messages on one line
Re: invalid subscript -
Misiur - 24.08.2012
Which line is 69629 now? Looks like it's in next function
Re: invalid subscript -
Vizi - 24.08.2012
ohh yea
For this
pawn Код:
IllegalCarNitroIde(carmodel) {
new illegalvehs[29] = { 581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 509, 481, 510, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 590, 569, 537, 538, 570, 449 };
foreach(illegalvehs, I) {
if (carmodel == illegalvehs[I])
return true;
}
return false;
}
Repp+ for you
Re: invalid subscript -
Misiur - 24.08.2012
It's exact same situation as in first code. You really don't see this?
pawn Код:
stock IllegalCarNitroIde(carmodel) {
new illegalvehs[29] = { 581, 523, 462, 521, 463, 522, 461, 448, 468, 586, 509, 481, 510, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 590, 569, 537, 538, 570, 449 };
for(new i = 0; i < sizeof(illegalvehs); ++i) {
if (carmodel == illegalvehs[i]) return true;
}
return false;
}
Re: invalid subscript -
Vizi - 24.08.2012
now for this :@
pawn Код:
stock islegalcarmod(vehicleide, componentid) {
new modok = false;
// stereo, hydraulics & nos (1x 2x 3x) are special.
if ( (iswheelmodel(componentid)) || (componentid == 1086) || (componentid == 1087) || ((componentid >= 1008) && (componentid <= 1010))) {
new nosblocker = IllegalCarNitroIde(vehicleide);
if (!nosblocker)
modok = true;
} else {
// check if the specified model CAN use this particular mod.
foreach(legalmods, I) {
if (legalmods[I][0] == vehicleide) { // first is car IDE
for(new J = 1; J < 22; J++) { // start with 1
if (legalmods[I][J] == componentid)
modok = true;
}
}
}
}
return modok;
}
i dont see what are you doing ::@
Re: invalid subscript -
Misiur - 24.08.2012
Simply replace each
to
pawn Код:
for(new I = 0, N = sizeof(legalmods); I < N; ++I) {
//Alternate
for(new I = 0; I < sizeof(legalmods); ++I) {
Don't miss the brace, and you are good to go