function gadget:GetInfo() return { name = "miner thing", desc = "flag theminers", author = "zwzsg", date = "4 Oct 2010", license = "10$/month", layer = 0, enabled = true }end-- Warning: Typed offhand, never tested, so will prolly crash on first runif (gadgetHandler:IsSyncedCode()) then local Miners={} local MinerCount=0 function gadget:Initialize() _G.MinerCount=MinerCount _G.Miners=Miners end function gadget:UnitFinished(unitID, unitDefID, teamID) MinerCount=MinerCount+1 _G.MinerCount=MinerCount table.insert(Miners,unitID) _G.Miners=Miners -- That line probably not needed end function gadget:UnitDestroyed(unitID, unitDefID, teamID, attackerID) MinerCount=MinerCount-1 _G.MinerCount=MinerCount for k,v in ipairs(Miners) do if v==unitID then table.remove(Miners,k) end end _G.Miners=Miners -- That line probably not needed endelse-- unsynced function gadget:DrawWorld() -- WARNING! -- You cannot use # on a table received through SYNCED. -- You cannot use ipairs on a table received through SYNCED. for k=1,SYNCED.MinerCount do local u=SYNCED.Miners[k] local x,y,z=Spring.GetUnitPosition(u) gl.DrawGroundCircle(x,y,z,64,12) end endend-- Instead of going through the pain of scanning the table to remove destroyed unit,-- and of storing the minercount, you could have used a table of true indexed by unit id-- and to scan it with for u,_ in pairs(...) in unsynched-- But I wanted to use a 1...n indexed table of uid to show that # and ipairs are lost