MummyKillerSLO Posted May 22, 2010 Posted May 22, 2010 Hello! I am new at MTA Scripting and I want to ask you, why vehicles don't fix using my code: function AutoFix() vehicles = getElementsByType ( "vehicle" ) for vehicleKey,vehicleValue in ipairs(vehicles) do fixVehicle ( vehicleValue ) setElementHealth ( vehicleValue, 1000.0 ) end end setTimer(AutoFix,1000,1) I am using just MTA editor to make maps, so I need just this command. Any help will be great.
dzek (varez) Posted May 22, 2010 Posted May 22, 2010 1. use lua tags, not code 2. setTimer(AutoFix,1000,1) -- 3rd argument is time to repeat (check wiki page!) setTimer(AutoFix,1000,0) -- this one is correct Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
50p Posted May 22, 2010 Posted May 22, 2010 Hello!I am new at MTA Scripting and I want to ask you, why vehicles don't fix using my code: function AutoFix() vehicles = getElementsByType ( "vehicle" ) for vehicleKey,vehicleValue in ipairs(vehicles) do fixVehicle ( vehicleValue ) setElementHealth ( vehicleValue, 1000.0 ) end end setTimer(AutoFix,1000,1) I am using just MTA editor to make maps, so I need just this command. Any help will be great. This timer will call AutoFix function only once and if this code is not attached to any event, it will be called once after resource starts. I'd suggest to add a command: function AutoFix () -- your code in AutoFix is fine end addCommandHandler( "fixall", AutoFix ) If you want the timer to call your AutoFix function unlimited amount of times every second then use 0 for the 3dr parameter (which is 1 in your code). - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
dzek (varez) Posted May 23, 2010 Posted May 23, 2010 btw: setting cars immune to damages could be better i think.. Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
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