Jump to content

Ficar pressionando


Recommended Posts

Qual o script, para quando eu ficar pressionando a tecla a animação continue, e quando eu soltar a animação para? Eu fiz um projeto, más ele so funciona se apertar.

addEventHandler("onResourceStart", resourceRoot,
function()
    for i, player in ipairs(getElementsByType("player")) do
        bindKey(player,"m", "down", "sit")
    end
end)

function toggleSit(thePlayer)
    if seat == false then
        setPedAnimation(thePlayer, "ped", "IDLE_taxi", -1, false, false, false, false)
        seat = true
    elseif seat == true then
        setPedAnimation(thePlayer)
        seat = false
    end
    end


addCommandHandler("sit", toggleSit)

Link to comment

Tente isso, não é a melhor maneira mas deve funcionar.

addEventHandler("onResourceStart", resourceRoot,
function()
    for i, player in ipairs(getElementsByType("player")) do
        bindKey(player,"m", "down", toggleSit)
      	bindKey(player,"m", "up", toggleSit)
    end
end)

function toggleSit(thePlayer)
    if seat == false then
        setPedAnimation(thePlayer, "ped", "IDLE_taxi", -1, false, false, false, false)
        seat = true
    
    elseif seat == true then
        setPedAnimation(thePlayer)
        seat = false
    end
end

Não testei!

Link to comment
  • 2 weeks later...

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