--[[ Autor: madvalue ]] function detectVehiclesInWater() local in_water = {}; local count = 0; local wyjebano = 0; for i,v in ipairs(getElementsByType("vehicle")) do if isElementInWater(v) then count = count + 1; if wyjebDoPrzecho(v) then wyjebano = wyjebano + 1; end end end outputDebugString("Samochody przeniesione do przechowalni " .. wyjebano .. " z " .. count .. " obecnych w wodzie"); end setTimer(detectVehiclesInWater, 1*60000, 0); function wyjebDoPrzecho(veh) local wyk = exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1 WHERE id=?", getElementData(veh, "vehicle:id")); if getElementData(veh, "vehicle:id") then if wyk then exports["pystories-vehicles"]:onSaveVehicle(veh); destroyElement(veh); return true; end end end