SA-MP Forums Archive
Object not destroying - 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: Object not destroying (/showthread.php?tid=603088)



Object not destroying - lulo356 - 18.03.2016

I've tryed CreatePlayerObject + DestroyPlayerObject and that didn't work
Even with Dyamaic object is this object not destroying, can you help me out?

PHP код:
PlacedBom[playerid] = CreateObject(1252bomX-0.5,bomY,bomZ-0.65,0,-1,-1); 
PHP код:
DestroyObject(PlacedBom[playerid]); 



Re: Object not destroying - Virtual1ty - 18.03.2016

DestroyObject() works fine. If it didn't people would know about it. I tested this on a local server with your exact code and the object does get destroyed.
You most likely have object ID mixups in your code. "PlacedBom" gets overwritten with a new ID and references a wrong object.


Re: Object not destroying - lulo356 - 18.03.2016

Alright, I've created now
Quote:

new PlacedBom[MAX_PLAYERS][2];

but.. it still not destroying

Quote:

PlacedBom[playerid][0] = CreateObject(1252, bomX-0.5,bomY,bomZ-0.65,0,-1,-1);[works]
PlacedBom[playerid][0] = SetTimerEx("vaultdoorboem", 10000, 0, "i", playerid);[works]
DestroyObject(PlacedBom[playerid][0]);[don't work]




Re: Object not destroying - ATGOggy - 18.03.2016

The value of that variable changed when you a assigned it a timer is.
Each elements have unique ids starting from 0.
Earlier, that variable used to have the Id of the object (eg:- 5), and when you assigned the Id of a timer(eg:-10) to that variable, DestroyObject will destroy the object with Id 10 instead of Id 5.

Change this:
PHP код:
PlacedBom[playerid][0] = SetTimerEx("vaultdoorboem"100000"i"playerid);[ 
To this:
PHP код:
PlacedBom[playerid][1] = SetTimerEx("vaultdoorboem"100000"i"playerid);