Posts: 790
Threads: 7
Joined: Mar 2008
Reputation:
0
You don't take into account that objects can be destroyed at any time.
Just make a function that loops through all id's from 1 to 1000. Check with 'IsValidObject(objectid)' and up the variable by one each time the statement is true.
Important note: this method will give an incorrect value when using a streamer.
EDIT: Fixed mistake pointed out by ******.
Posts: 104
Threads: 4
Joined: Oct 2012
Reputation:
0
stock CountCreatedObjects() {
- new Objects = 0;
-
- for(new objectid = 0; objectid < MAX_OBJECTS; objectid++) {
- - if(IsValidObject(objectid)) Objects++;
- }
-
- return Objects;
}
Note: Every - is an indent.
Something like that... I guess.
Posts: 3,793
Threads: 196
Joined: Jan 2010
Reputation:
0
In my honest opinion, hooking > looping. This should of been posted in the useful functions thread anyway