invalid subscript
#1

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;
}
Reply
#2

pawn Код:
for(new I = 0; I < sizeof(wheelmodels); ++I)
Reply
#3

Same bro :S
Reply
#4

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
Reply
#5

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
Reply
#6

Which line is 69629 now? Looks like it's in next function
Reply
#7

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
Reply
#8

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;
}
Reply
#9

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 ::@
Reply
#10

Simply replace each
pawn Код:
foreach(legalmods, I) {
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)