AlexanderMcArov 0 Posted July 31, 2020 Share Posted July 31, 2020 Hey guys. Problem with "setTimeout"... When i using only while(true), it's working OK or when i using only setTimerout(); it's working OK , too. BUT! When i using setTimeout and while , together.. it's not working. How I should do script, for Timer int while()? sorry for my English. mp.events.add("playerEnterColshape", (player, shape) => { if(shape == CarrierShape){ player.notify('You started downloading cargo-box. '); vehicle.colshape = true; while(true){ // it's check vehicle on colshape setTimeout(() => { vehicle.width += 10; player.call('cargoveh',[vehicle.width]); player.vehicle.setVariable('width',vehicle.width); player.outputChatBox('Downloading : ' + player.vehicle.getVariable('width')); if(vehicle.width >= 500) break; },1000); } } }); Link to post Share on other sites
goth123 2 Posted July 31, 2020 Share Posted July 31, 2020 Use setInterval without while loop. 1 1 Link to post Share on other sites
AlexanderMcArov 0 Posted July 31, 2020 Author Share Posted July 31, 2020 Succesfull. Link to post Share on other sites
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