[Include] exobjects - Extended object functions
#1

Yesterday I noticed that streamer objects had two natives that the regular objects didn't. What a discrimination! I decided to create a small include that adds two new functions:

PHP код:
CountObjects();
DestroyAllObjects(); 
It was simple for me to create but I decided to release it as it might be useful for someone.


Download: http://pastebin.com/jicmLEQ7


A (totally useless) test script:

PHP код:
#include <a_samp>
#include <exobjects>
main() {}
public 
OnGameModeInit()
{
    for (new 
i5i++)
    {
        
CreateObject(1215000000);
        
printf("%i"CountObjects());
    }
    
DestroyAllObjects();
    
printf("%i"CountObjects());
    return 
1;

Enjoy!
Reply
#2

Looks like you did this incorrectly how is anyone supposed to get the objectid with this?

exobj_count++;
return 1;
Reply
#3

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
Looks like you did this incorrectly how is anyone supposed to get the objectid with this?

exobj_count++;
return 1;
exobj_count is only used for CountObjects. It returns the count of all objects not the ID of the last object.



Edit:

I was afraid for a while that CountDynamicObjects doesn't work the way I thought it does. I did a test and the results are same.

PHP код:
for (new i5i++)
    {
        
CreateObject(1215000000);
        
printf("%i"CountObjects());
    }
    
DestroyObject(2);
    
printf("%i"CountObjects());
    
DestroyAllObjects();
    
printf("%i"CountObjects());
    print(
"-----");
    for (new 
i5i++)
    {
        
CreateDynamicObject(1215000000);
        
printf("%i"CountDynamicObjects());
    }
    
DestroyDynamicObject(2);
    
printf("%i"CountDynamicObjects());
    
DestroyAllDynamicObjects();
    
printf("%i"CountDynamicObjects()); 
Edit: Ohh, return 1... I'll fix it asap.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)