array index out of bounds
#1

wtf?

pawn Code:
K:\WarHero source\gamemodes\Gamemode.pwn(6503) : error 032: array index out of bounds (variable "Club_Strippers_Actor")
K:\WarHero source\gamemodes\Gamemode.pwn(6512) : error 032: array index out of bounds (variable "Club_Bar_Actor")
K:\WarHero source\gamemodes\Gamemode.pwn(6916) : error 017: undefined symbol "i"
pawn Code:
//ptas
    Club_Strippers_Actor[0] = CreateDynamicActor(246, 1209.416503, -36.272216, 1001.484375, 17.0, .worldid = 0, .interiorid = 3);
    Club_Strippers_Actor[1] = CreateDynamicActor(87, 1215.355712, -33.439422, 1001.382812, 85.3, .worldid = 0, .interiorid = 3);
    CreateDynamic3DTextLabel("Valentina", 0xFFFFFFAA, 1209.416503, -36.272216, 1001.484375 + 0.3, 5.0, .testlos = false, .worldid = 0, .interiorid = 3);
    CreateDynamic3DTextLabel("Graciela", 0xFFFFFFAA, 1215.355712, -33.439422, 1001.382812 + 0.3, 5.0, .testlos = false, .worldid = 0, .interiorid = 3);
    //ptas2
    Club_Strippers_Actor[2] = CreateDynamicActor(64, 1209.416503, -36.272216, 1001.484375, 17.0, .worldid = 1, .interiorid = 3);
    Club_Strippers_Actor[3] = CreateDynamicActor(63, 1215.355712, -33.439422, 1001.382812, 85.3, .worldid = 1, .interiorid = 3);
    CreateDynamic3DTextLabel("Yamila", 0xFFFFFFAA, 1209.416503, -36.272216, 1001.484375 + 0.3, 5.0, .testlos = false, .worldid = 1, .interiorid = 3);
    CreateDynamic3DTextLabel("Ruth", 0xFFFFFFAA, 1215.355712, -33.439422, 1001.382812 + 0.3, 5.0, .testlos = false, .worldid = 1, .interiorid = 3);
    //ptas3
    Club_Strippers_Actor[4] = CreateDynamicActor(75, 1209.416503, -36.272216, 1001.484375, 17.0, .worldid = 2, .interiorid = 3);
    Club_Strippers_Actor[5] = CreateDynamicActor(238, 1215.355712, -33.439422, 1001.382812, 85.3, .worldid = 2, .interiorid = 3);
    CreateDynamic3DTextLabel("Leila", 0xFFFFFFAA, 1209.416503, -36.272216, 1001.484375 + 0.3, 5.0, .testlos = false, .worldid = 2, .interiorid = 3);
    CreateDynamic3DTextLabel("Brisa", 0xFFFFFFAA, 1215.355712, -33.439422, 1001.382812 + 0.3, 5.0, .testlos = false, .worldid = 2, .interiorid = 3);
   
    //cantina
    Club_Bar_Actor[0] = CreateDynamicActor(194, 1206.232788, -29.325387, 1000.953125, 270.0, .worldid = 0, .interiorid = 3);
    //cantina2
    Club_Bar_Actor[1] = CreateDynamicActor(171, 1206.232788, -29.325387, 1000.953125, 270.0, .worldid = 1, .interiorid = 3);
    //cantina3
    Club_Bar_Actor[2] = CreateDynamicActor(172, 1206.232788, -29.325387, 1000.953125, 270.0, .worldid = 2, .interiorid = 3);
   
    UpdateThePutis();
    SetTimer("UpdateThePutis", 3000, true);
pawn Code:
forward UpdateThePutis();
public UpdateThePutis()
{
    ApplyDynamicActorAnimation(Club_Bar_Actor[i], "BAR", "BARman_idle", 4.1, 1, 0, 0, 0, 0);
   
    new
        strip_anim = random(sizeof(RandomStripAnimations)),
        stripper = random(sizeof(Club_Strippers_Actor));
    ApplyDynamicActorAnimation(Club_Strippers_Actor[stripper], "STRIP", RandomStripAnimations[strip_anim], 4.1, 1, 0, 0, 0, 0);
   
   
    for(new i = 0; i != sizeof(Club_Actors); i ++)
    {
        ApplyDynamicActorAnimation(Club_Actors[i], "STRIP", RandomPayStripAnimations[random(sizeof(RandomPayStripAnimations))], 4.1, 1, 0, 0, 0, 0);
    }
    return 1;
}
Reply
#2

Check the declaration of arrays.The array index that you accessing might be larger than the highest valid entry of the array.
Also in the function UpdateThePutis you are using variable i as index before declaring it(may be provide more details on what you trying to achieve there?).

And i don't see the point in calling that public function directly and then again using a timer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)