--go_turrets function createVehicle(vechid, plyr) local vehicle = { } local c = plyr:getCoords() local test = g_arena:createVehicle(vechid, c.x, c.y, c.rotation) test:setFrequency(plyr:frequency()) vehicle['id'] = test:id() vehicle['vechid'] = test:typeid() vehicle['x'] = c.x vehicle['y'] = c.y vehicle['rotation'] = c.rotation vehicle['team'] = plyr.team go_turrets[''..test:id()..''] = vehicle end function checkVehicleDeath(vech) g_arena:message(''..vech:id()) local mytable = getn(go_turrets) for i=1, table.getn(mytable) do if (go_turrets[mytable[i]]['id'] == vech:id()) then go_turrets[mytable[i]] = nil end end end function saveObject_turrets() exportTSF(go_turrets, 'turrets', 'turret') end function loadObject_turrets() go_turrets = {} go_turrets = importTSF('turrets', 'turret') end function buildTurrets() local mytable = getn(go_turrets) for i=1, table.getn(mytable) do local vech = g_arena:createVehicle(go_turrets[mytable[i]]['vechid'], go_turrets[mytable[i]]['x'], go_turrets[mytable[i]]['y'], go_turrets[mytable[i]]['rotation']) go_turrets[mytable[i]]['id'] = vech:id() end end function checkTurretAssign(plyr) local mytable = getn(go_turrets) for i=1, table.getn(mytable) do local vech = vehicleFromId(g_arena, go_turrets[mytable[i]]['id']) if (go_turrets[mytable[i]]['team'] == plyr.team) then vech:setFrequency(plyr:frequency()) end end end