Not working?
#1

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);
}
Reply
#2

Bump.
Reply
#3

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
Reply
#4

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.
Reply
#5

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
Reply
#6

But it doesn't mean it's bugged. It's one of the most important native debugging tools
Reply
#7

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.
Reply
#8

Now it won't show up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)