Jump to content

TROCAR addCommandHandler PELA FUNÇÃO bindKey


Recommended Posts

-- Server-Side / Por Comando

addCommandHandler("F", function ( thePlayer )
   outputChatBox("Start", thePlayer, 255, 255, 255, true )
end)

-- Server-Side / Por Bindkey

addEventHandler("onPlayerLogin", root, function ( )
   bindKey ( source, "F", "down", sistema2 )
end)

addEventHandler("onResourceStart", resourceRoot, function ( )
   for i, players in ipairs( getElementsByType("player" ) ) do
      bindKey ( players, "F", "down", sistema2 )
   end
end)

addEventHandler("onResourceStop", resourceRoot, function ( )
   for i, players in ipairs( getElementsByType("player" ) ) do
      unbindKey ( players, "F", "down", sistema2 )
   end
end)

function sistema2 ( thePlayer )
   outputChatBox("Start", thePlayer, 255, 255, 255, true )
end

-- Client-Side / Por Comando

addCommandHandler("F", function (  )
   outputChatBox("Start", 255, 255, 255, true )
end)

-- Client-Side / Por Bindkey

function sistema2 (  )
   outputChatBox("Start", 255, 255, 255, true )
end
bindKey("F7", "down", sistema2 )

Espero ter ajudado.

Link to comment
On 17/05/2020 at 16:23, +Gabriel said:

Eu só queria saber como eu faço pra trocar essa função de comando, para uma de tecla. Ao invés de ter que digitar o comando, eu queria que apenas pressionasse "F"

bindKey("F", "down", sistema2)

 

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