Count Object??? - 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: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Count Object??? (
/showthread.php?tid=261933)
Count Object??? -
Ronaldo_raul™ - 15.06.2011
Hey guys i want some help ......when i open my samp-server ....and when everything has loaded i see some lines written like -
Код:
Number Of Vehicles Models:113
Is this the vehicle count
How can i get it for objects so the total object are calculated and it shows like this-
Код:
Number Of Objects Loaded:123455
Help me please !
Thank you for your time !
Re: Count Object??? -
Mike Garber - 15.06.2011
pawn Код:
// AT TOP
new objectcount;
// SOMEWHERE. NOT INSIDE A CALLBACK
CreateObjectEx(modelid,Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ,Float:DrawDistance = 0.0)
{
objectcount++;
CreateObject(modelid,X,Y,Z,rX,rY,rZ,DrawDistance);
}
// AFTER YOU HAVE CREATED ALL OBJECTS
printf("Number of objects created: %d",objectcount);
And change all CreateObject to CreateObjectEx
Re: Count Object??? -
Ronaldo_raul™ - 15.06.2011
Quote:
Originally Posted by Mike Garber
pawn Код:
// AT TOP new objectcount;
// SOMEWHERE. NOT INSIDE A CALLBACK CreateObjectEx(modelid,Float:X,Float:Y,Float:Z,Float:rX,Float:rY,Float:rZ,Float:DrawDistance = 0.0) { objectcount++; CreateObject(modelid,X,Y,Z,rX,rY,rZ,DrawDistance); }
// AFTER YOU HAVE CREATED ALL OBJECTS printf("Number of objects created: %d",objectcount);
|
hmm ....didn't understood nicely....

....i am using incognito's streamer so what can i do

??
copy all the objects

any example would be nice!
Re: Count Object??? -
xRyder - 15.06.2011
There is a native function for that.
pawn Код:
native CountDynamicObjects();
Re: Count Object??? -
Ronaldo_raul™ - 15.06.2011
Quote:
Originally Posted by xRyder
There is a native function for that.
pawn Код:
native CountDynamicObjects();
|
so where to put this

?
will this count all my objects

? and print it to the server window

?
Re: Count Object??? -
xRyder - 15.06.2011
Try it and you'll find out.
EDIT: But notice that if you create object after counting them like:
pawn Код:
CreateDynamicObject()....
CreateDynamicObject()....
CreateDynamicObject()....
prinf("There are %d objects in your script", CountDynamicObjects());
CreateDynamicObject()....
it will count like there are 3 objects.
You'll need to create them before calling CountDynamicObjects() function.