Jump to content

Wprowadzenie ograniczenia do funkcji [HELP]


Recommended Posts

Witam, wprowadziłem funkcję do 'wheels moda' który po wciśnięciu F1 wyłącza się lub włącza. Chciałbym wprowadzić ograniczenie do tej funkcji ( 5 sec ). Aby wyłączyć/włączyć można było dopiero po 5 sekundach.

state = true 
function rWheels() 
    state = not state 
    if state then 
        for _,v in pairs(wheels) do 
            engineRestoreModel(v[2]) 
        end 
        outputChatBox('You chose original car wheels') 
    else 
        replace() 
        outputChatBox('You chose modified car wheels') 
    end 
end 
bindKey ( "F1", "down", rWheels ) 

Link to comment
  
state = true 
tick = getTickCount () - 5000 
function rWheels() 
    if getTickCount () - tick > 5000 then 
        state = not state 
        if state then 
            for _,v in pairs(wheels) do 
                engineRestoreModel(v[2]) 
            end 
            outputChatBox('You chose original car wheels') 
        else 
            replace() 
            outputChatBox('You chose modified car wheels') 
        end 
        tick = getTickCount () 
    end 
end 
bindKey ( "F1", "down", rWheels ) 
  

Link to comment

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...