Quote:
Originally Posted by fysiks
I'm not sure how you don't get any index out-of-bounds errors because you're trying to index an array from 0 to 99 where the array is much much smaller than 100 (in your case 4 or 5 depending on which function call you're using).
You can actually determine the size of the provided array by using the sizeof directive as the default for a "length" parameter:
PHP Code:
myFunction(myArray[], len = sizeof myArray) { server_print("Array Size: %d", len) }
where
PHP Code:
myFunction({1,3,5}) myFunction({1}) myFunction({2,34,3.34,3.0,34.0,34,0.0})
results in:
Code:
Array Size: 3
Array Size: 1
Array Size: 7
|
nop, u are wrong, the loop doesnt count from 0 to 100, look:
if this is my array:
the loop do this:
PHP Code:
// i i++
Array[0] = 2 // i = 0
Array[1] = 4 // i = 1
Array[2] = 6 // i = 2
Array[3] = 100 // i = 3, oops this cell contain 100, so we can stop
thats why the condition,
PHP Code:
__int_Entitys[i] < 100
if it was counting from 0 to 100, it will be
, but isnt the case, u can check it by yourself with the prints that i setted
check it with this:
PHP Code:
public Test( Client )
{
removeTransEnts( Client, {2,8,15,100} );
return 1;
}
removeTransEnts(Client, __int_Entitys[] )
{
for( new i = 0; __int_Entitys[i] < 100; i++)
{
client_print( Client, print_chat, "The Cell [%d] have a value of = %d", i, __int_Entitys[i] );
}
client_print( Client, print_chat, "End of the Loop" );
}