loop entitys
hi, i wanted to know how can i loop these entitys, i wanted to remove it, and reeplace the setentremove function
here is my actual code PHP Code:
Edit. Solution: PHP Code:
|
Re: loop entitys
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:
PHP Code:
Code:
Array Size: 3 |
Re: loop entitys
Quote:
nop, u are wrong, the loop doesnt count from 0 to 100, look: if this is my array: PHP Code:
PHP Code:
PHP Code:
PHP Code:
check it with this: PHP Code:
|
Re: loop entitys
Why don't you initiate the array as the following it will be less complex and easier to understand .
PHP Code:
|
Re: loop entitys
Quote:
|
Re: loop entitys
What simpler with this ?
PHP Code:
|
Re: loop entitys
Quote:
PHP Code:
PHP Code:
If you still do not understand you should read better, I explain it in detail above https://forums.alliedmods.net/showpo...00&postcount=3 |
Re: loop entitys
Why don't you make the loop as following it will be rather than using 100 to stop the loop.
PHP Code:
PHP Code:
|
Re: loop entitys
Quote:
Quote:
in a loop the simpler is better, think that each time you will be checking and obtaining the length of the array (-1), instead with 100, it only checks if it is the cell contain 100 |
Re: loop entitys
Quote:
What if the number of loop is smaller, for example, only 10 is required. But it have to run 100 times every single time because you hardcode it to 100 Isn't that worse? Not to mention, you are using a giantic array2D with the size of 3100+ (100 entity x 31 clients) so that would cost much more performen than that small check in for-loop is 2. The anwser code feel really weird to me. Tell me if I am wrong: With this as example PHP Code:
=> you want to get this
If that the case, what you want to loop is __int_Entitys[]'s size NOT the value insde it. The code can change it into this PHP Code:
|
All times are GMT -4. The time now is 09:28. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.