Object IDs messed up? (not model IDs!)
#1

hi,

ive been creating objects lately.
After a certain time i destroy not needed objects to stay within the samp object limit. (i also use a streamer for custom mapped worlds but i need non dynanic objects at certain parts so players wont fall through it when they spawn as with dynamic objects it sometimes happens that the object is not streamed in fast enough.)

So i create objects like this:

pawn Код:
Obj[0]=CreateObject(900, -4473.58203, 3396.04590, 13.41680,   0.00000, 0.00000, 0.00000);
Obj[1]=CreateObject(900, -4473.58203, 3396.04590, 13.41680,   0.00000, 0.00000, 0.00000);

DesertObj[0]=CreateObject(900, -1425.98315, 3738.58618, 10.87436,   0.00000, 0.00000, 0.00000);
DesertObj[1]=CreateObject(900, -1427.61523, 3790.40039, 10.87436,   0.00000, 0.00000, 0.00000);
And then when not needed anymore i destroy them like this:
pawn Код:
if(IsValidObject(Obj[0]))DestroyObject(Obj[0]);
if(IsValidObject(Obj[1]))DestroyObject(Obj[1]);

if(IsValidObject(DesertObj[0]))DestroyObject(DesertObj[0]); if(IsValidObject(DesertObj[1]))DestroyObject(DesertObj[1]);
Now the problem is, somehow internally the object IDs seem to be messed up!
Sometimes when i destroy DesertObj[0] then another object is destroyed for example Obj[1] and not how its supposed to be DesertObj[0].

I experience this pretty often, is there a fix for it?
Is this a know bug of SAMP?

What can i do?

Would be glad about some hints

thank you.
Reply
#2

Why not make them dynamic objects, but when you enter into door or something you will TogglePlayerControllable and set a timer that will unfreeze them after. That will prevent them from falling through
Reply
#3

i did it that way before but it really annoys me and the players after a certain time when they are always freezed after spawn also when its a short time.
I will have to do it again in case i cant fix this in time tho...

thx for ur reply

Do you know it it might be a conflict between GM and FS script?
Is it possible that when i create dynamic and non dynamic objects in both scripts that might be causing issues?
Reply
#4

that probably is the problem, just use createdynamicobjects
Reply
#5

Show me the array definitions please
Reply
#6

If you have code like this your doing something wrong.

pawn Код:
Obj[0]=CreateObject(900, -4473.58203, 3396.04590, 13.41680,   0.00000, 0.00000, 0.00000);
Obj[1]=CreateObject(900, -4473.58203, 3396.04590, 13.41680,   0.00000, 0.00000, 0.00000);
You should almost never have to reference consecutive array elements. What you should do is add these objects into some kind of object pool then delete by that pool id. What I think is happening is you don't dereference these variables when you delete then try and delete again without actually referencing new objects so it's deleting any objects with those id's.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)