open.mp forum
[Pawn] Disappearance of dynamic objects - Printable Version

+- open.mp forum (https://forum.open.mp)
+-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
+--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
+--- Thread: [Pawn] Disappearance of dynamic objects (/showthread.php?tid=1423)



Disappearance of dynamic objects - Radical - 2020-12-15

I have 10,300 dynamic objects, some of which disappear after 24 hours.

Game mode runs on a vps with 1 GB of RAM.

The problem is the lack of RAM or what?


RE: Disappearance of dynamic objects - Pinch - 2020-12-15

Should be lack of RAM


RE: Disappearance of dynamic objects - DaZzY - 2020-12-16

Do you use latest Streamer Plugin & include versions ?


RE: Disappearance of dynamic objects - Radical - 2020-12-17

I upgraded the VPS RAM to 6GB.
But still, dynamic objects disappear.
I have the latest version of streamer


RE: Disappearance of dynamic objects - Markski - 2020-12-19

I've faced this error a few times, avoiding it comes down to following two key practices:



- Always check if a dynamic object is valid with IsValidDynamicObject(objectid) before destroying it.

- When destroying an object, ALWAYS set the variable which held it to INVALID_OBJECT_ID to avoid collisions with newly created objects in the future.



This helper should do both:



Code:
stock DestroyDynObj(&objectid) { new bool:success = false; if (IsValidDynamicObject(objectid) { DestroyDynamicObject(objectid); success = true; } objectid = INVALID_OBJECT_ID; return success; }