Not working? - 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)
+--- Thread: Not working? (
/showthread.php?tid=363585)
Not working? -
JaKe Elite - 28.07.2012
I was working a CreateObject counting system,
suddenly it always shows the total of create object is 397
even i remove one or more than 2 createobject it still shows as 397.
code
pawn Код:
new objects = 0;
#if defined _CreateObject
#undef CreateObject
#endif
#define CreateObject x_CreateObject
x_CreateObject(modelid, Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ, Float:DrawDistance = 0.0)
{
objects++;
CreateObject(modelid, X, Y, Z, rX, rY, rZ, DrawDistance);
}
main()
{
printf("Total of Server Objects created: %d", objects);
}
Re: Not working? -
JaKe Elite - 03.08.2012
Bump.
Re: Not working? -
SEnergy - 03.08.2012
print is a little bit bugged if I can say that, I've tried to do several debugs with print too and it was giving me always the same number, you have to do it with sendclientmessage and command
Re: Not working? -
RelaxCafe - 03.08.2012
Quote:
Originally Posted by SEnergy
print is a little bit bugged if I can say that, I've tried to do several debugs with print too and it was giving me always the same number, you have to do it with sendclientmessage and command
|
What bunch of BS. Anyways.. printf works great. The way you are using it, there is no problem for it to not work. Now Romel, why don't you put this: "printf("Total of Server Objects created: %d", objects);" One line after all the objects are created? That's the best way for it to work though because I have no idea where you actually are creating those objects.. And main() gets called before anything else. So that's why the number is doesn't change. Well, shouldn't the number be zero at least? Maybe it has got some unused value in the memory, but I don't think that is the case because you actually put the value to it.
Re: Not working? -
SEnergy - 03.08.2012
Quote:
Originally Posted by RelaxCafe
What bunch of BS. Anyways.. printf works great. The way you are using it, there is no problem for it to not work. Now Romel, why don't you put this: "printf("Total of Server Objects created: %d", objects);" One line after all the objects are created? That's the best way for it to work though because I have no idea where you actually are creating those objects.. And main() gets called before anything else. So that's why the number is doesn't change. Well, shouldn't the number be zero at least? Maybe it has got some unused value in the memory, but I don't think that is the case because you actually put the value to it.
|
I'm just saying what problem I encountered, it was always saying 0 even when I called that variable ingame it was higher
Re: Not working? -
Misiur - 03.08.2012
But it doesn't mean it's bugged. It's one of the most important native debugging tools
Re: Not working? -
leonardo1434 - 03.08.2012
main is one of the first things to be loaded, i guess even before the ongamemodeinit, so, this might be the problem.
test it in the end of the callback ongamemodeinit. may solve it.
Re: Not working? -
JaKe Elite - 03.08.2012
Now it won't show up.