I have not made this code yet, but... i try to explain..

I am working on a Command and Conquer game. The game allows you to build your base and build tanks, different tanks and lots of tanks...

now, i am making it so when you logout your tanks go into your inventory, So you can deploy them at your next login.

problem is if they own alot of tanks and there all over the map how do i delete them at logout.

there is a owner var for all there tanks

my game


Keep a list with the tanks reference in it or have an "owner" type of variable defined.

Either way, you will need to loop through either the list or the world (depending on the method you have chosen) and delete the tanks.
In response to GhostAnime
Do both. The tanks should have an owner variable for when you need to know who a specific tank belongs to, like for when crediting the kill or the AI. You should also give each player a list of tanks so that you can find them whenever you want. Just every time you make a tank, add it to that player's list.
I don't think it'd be that nessecary to loop through all tanks in the world and check if they're owner-less, but the code below will work without the loop so long as the player mob is deleted upon logout.

proc/tankLoop() //needs to be called through world/New()
for(var/obj/tank/O in world)
if(!O.owner) del O

if(!tanks) tanks=new/list()
if(tanks && tanks.len) for(var/obj/tank/O in tanks) del O
del src

if(!owner) del src

-- Data
In response to Android Data
awesome script thanks so much

but a obj creates the tank how do i logout if the list is a obj var/list
In response to Garthor

is it possible to use a obj list in logout

as per android data code?

my tanks are made by a obj (base) on the map the list is a obj list

when i try to run androids code it gives me a error cause its looking for a mob list ???

please help !!
In response to Kylemark
I assume the base has an owner variable, in which case you just have to add it to the base's owner's list.