Okay, I'm a bit confused right now since it's more advanced compared to my curent knowledge in Pawn. Nevertheless, you said that the problem is the array's index which is wrong, which makes me think the problem is from the random( g_iOrigins ) function?
If yes, what's wrong with it? g_iOrigins gets incremented above in the SsDump() function.
Edit:
The array I have :
g_vecOrigins = ArrayCreate( 3, 1 ); //cellsize is set to 3 and reserved to 1, but this is not valid until we call ArraySet