Parazitas Posted August 22, 2018 Share Posted August 22, 2018 Hello im trying to make script who destroys all empty fagio in map after some time. maybe some help? function deletefag() vehicles = getElementsByType("vehicle") for i,v in ipairs(vehicles) do if (getElementModel(v) == modelID) then destroyElement(v) end end end setTimer(deletefag, 5000, 0) deletefag(462) Link to comment
Storm-Hanma Posted August 22, 2018 Share Posted August 22, 2018 Why r you using last line delete :O(462)? setTimer(deletefag, 5000,1 ) Link to comment
Crossy101 Posted August 23, 2018 Share Posted August 23, 2018 (edited) function DestroyAllFagios(playerSource) local allVehicles = getElementsByType("Vehicle") for i,v in ipairs(allVehicles) do if getElementModel(v) == 462 then local counter = 0 for seat, player in pairs(getVehicleOccupants(v)) do counter = counter + 1 end if counter == 0 then blowVehicle(v) end end end end addCommandHandler("destroyfagios", DestroyAllFagios) Something like this would work! Good Luck! Edited August 23, 2018 by Crossy101 Link to comment
Crossy101 Posted August 23, 2018 Share Posted August 23, 2018 35 minutes ago, Crossy101 said: function DestroyAllFagios(playerSource) local allVehicles = getElementsByType("Vehicle") for i,v in ipairs(allVehicles) do if getElementModel(v) == 462 then local counter = 0 for seat, player in pairs(getVehicleOccupants(v)) do counter = counter + 1 end if counter == 0 then blowVehicle(v) end end end end addCommandHandler("destroyfagios", DestroyAllFagios) Something like this would work! Good Luck! Just add: SetTimer(5000, DestroyAllFagios, 1) to the bottom of the function! Link to comment
Parazitas Posted August 23, 2018 Author Share Posted August 23, 2018 thank you so much! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now