Facebook
From Chunky Bee, 3 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 189
  1. --[[
  2.         Autor: madvalue <[email protected]>
  3. ]]
  4. function detectVehiclesInWater()
  5.         local in_water = {};
  6.         local count = 0;
  7.         local wyjebano = 0;
  8.  
  9.         for i,v in ipairs(getElementsByType("vehicle")) do
  10.                 if isElementInWater(v) then
  11.                         count = count + 1;
  12.  
  13.                         if wyjebDoPrzecho(v) then
  14.                                 wyjebano = wyjebano + 1;
  15.                         end
  16.                 end
  17.         end
  18.  
  19.         outputDebugString("Samochody przeniesione do przechowalni " .. wyjebano .. " z " .. count .. " obecnych w wodzie");
  20. end
  21. setTimer(detectVehiclesInWater, 1*60000, 0);
  22.  
  23. function wyjebDoPrzecho(veh)
  24.         local wyk = exports["pystories-db"]:dbSet("UPDATE pystories_vehicles SET parking=1 WHERE id=?", getElementData(veh, "vehicle:id"));
  25.     if getElementData(veh, "vehicle:id") then
  26.                 if wyk then
  27.                         exports["pystories-vehicles"]:onSaveVehicle(veh);
  28.                         destroyElement(veh);
  29.                         return true;
  30.                 end
  31.         end
  32. end