Chaz-CR Posted August 10, 2013 Posted August 10, 2013 Hi well, i've been trying to change a command handler whit a timer but i couldn't. I'd like you guys help me cuz i dont know how to do this line works thanks! Here is the code! function saveAllVehiclesAlternative () local file = fileCreate( "vehicles.xml" ) local vs = 0 local prec = getTickCount() fileWrite( file, "\n" ) for k, i in ipairs ( getElementsByType( "vehicle" ) ) do if allVehicles[i] then local x, y, z = getElementPosition( i ) local ar, ag, ab, br, bg, bb, cr, cg, cb, dr, dg, db = getVehicleColor( i, true ) fileWrite( file, " \""..allVehicles[i].."\" model=\""..getElementModel( i ).."\" pos=\""..toJSON({x, y, z}).."\" color=\""..toJSON({ar, ag, ab, br, bg, bb, cr, cg, cb, dr, dg, db}).."\" paintjob=\""..getVehiclePaintjob(i).."\" upgrades=\""..toJSON( getVehicleUpgrades(i) ).."\" interior=\""..getElementInterior(i).."\" dimension=\""..getElementDimension(i).."\" /> \n" ) vs = vs + 1 end end fileWrite( file, " \n" ) fileClose( file ) outputDebugString( vs.." vehiculos guardados en "..getTickCount()-prec.." ms", 3 ) end addCommandHandler( "preguard", saveAllVehiclesAlternative )
Castillo Posted August 10, 2013 Posted August 10, 2013 Just do: setTimer ( saveAllVehiclesAlternative, 60000, 0 )
Chaz-CR Posted August 10, 2013 Author Posted August 10, 2013 Thanks Solid. Offtopic: Where can i contact you for something about a resource?
tosfera Posted August 10, 2013 Posted August 10, 2013 You can either PM him on the forums, or talk to him on skype. (Hard to reach him there I tell ya!)
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