[Include] exobjects - Extended object functions - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] exobjects - Extended object functions (
/showthread.php?tid=480596)
exobjects - Extended object functions -
kristo - 11.12.2013
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 i; i < 5; i++)
{
CreateObject(1215, 0, 0, 0, 0, 0, 0);
printf("%i", CountObjects());
}
DestroyAllObjects();
printf("%i", CountObjects());
return 1;
}
Enjoy!
Re: exobjects - Extended object functions -
Pottus - 11.12.2013
Looks like you did this incorrectly how is anyone supposed to get the objectid with this?
exobj_count++;
return 1;
Re: exobjects - Extended object functions -
kristo - 11.12.2013
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 i; i < 5; i++)
{
CreateObject(1215, 0, 0, 0, 0, 0, 0);
printf("%i", CountObjects());
}
DestroyObject(2);
printf("%i", CountObjects());
DestroyAllObjects();
printf("%i", CountObjects());
print("-----");
for (new i; i < 5; i++)
{
CreateDynamicObject(1215, 0, 0, 0, 0, 0, 0);
printf("%i", CountDynamicObjects());
}
DestroyDynamicObject(2);
printf("%i", CountDynamicObjects());
DestroyAllDynamicObjects();
printf("%i", CountDynamicObjects());
Edit: Ohh, return 1... I'll fix it asap.