Moved objectvwith obj array
#1

Hello guys sorry for need to ask again last post im making obj array
i have 177 object so im create array
pawn Код:
new obj [178] = createobject blah blah
so now if i want when im type cmd its moving with use obj
so im try do it but it show error
array out of index
i should plus it or do something with it ?
Can someone help me plz thank you
examplez
pawn Код:
Moveobject(obj[178],0,0,10,2.0);
So what i should do help me plz thank you very much
Reply
#2

178th cell would be the null terminator, you can use it up to the 177th one, I guess?
Reply
#3

Im use obj [177]
But it show error array out of index :P
Reply
#4

pawn Код:
new objects[178];
for ( new i = 0; i < sizeof ( objects ) ; i ++ )
{
     objects[ i ] = CreateObject( ... );
     printf( "Index %d assigned to object id.", i ) ;
}
Try debugging. (It would spam) Tell us where you declare the array, how you assign it, some code mate, some code.
Reply
#5

Okay this my code ^_^
pawn Код:
new obj[178];
public OnFilterscriptsInit()
{

obj[1] = CreateObject(18483,836.9000200,-2102.8000500,12.0000000,0.0000000,0.0000000,90.0000000); //object(cuntsrod07) (1)
blah blah blah
.
.
obj [177] = CreateObject(1318,838.0000000,-2294.0000000,13.4483800,0.0000000,0.0000000,90.0000000); //object(arrow) (1)
MoveObject(obj[178], 0, 0, -50, 2.00);
}
public OnPlayerText(playerid, text[])
{
    if(strfind("upplz", "upplz", true) != -1)
   
   
    {
    MoveObject(obj, 0, 0, 12, 2.00);
    }
    return 1;
   
}
Reply
#6

If you have new obj[178]; you can only use slot 0 to 177. (This is 178 slots total.) If you're accessing slots out of that bound, you either need to increase the bound (make the array bigger) or change the slot number.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)