Jump to content

while(true){ setTimeout();} not working.


Recommended Posts

Posted

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", (playershape=> {
    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); 
        } 
    }   
});

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...