Jump to content

Problema com bind


Recommended Posts

Estou fazendo um sistema que ao passar pelo marker e apertar "e", spawnaria um veiculo, porem esta spawnando 2 veiculos (quando aperta e quando solta a tecla), mas queria que spawnasse apenas quando apertasse.

O código esta assim: 

local g1 = createMarker (1517.796, -694.59, 92.00, "cylinder", 3.0, 184,0,0, 150)

addEventHandler ("onClientMarkerHit", g1, function()
addEventHandler ("onClientKey", root, function (button, press)
if isElementWithinMarker (localPlayer, g1) then
	if button == "e" then
        createVehicle ( 402, 1517.172, -690.4, 94.75, 0, 0, 100)
    end 
end 
end )
end )

 

Link to comment
local g1 = createMarker (1517.796, -694.59, 92.00, "cylinder", 3.0, 184,0,0, 150)

addEventHandler ("onClientKey", root, function (btn, press)
    if isElementWithinMarker (localPlayer, g1) and press then
        if btn == "e" then 
            createVehicle (402, 1517.172, -690.4, 94.75, 0, 0, 100)
        end
    end
end)
  • pressOrRelease: This refers to whether they were pressing or releasing the key, true when pressing, false when releasing.

É necessário verificar se a tecla esta pressionada ou solta.

Link to comment
3 minutes ago, Jonas^ said:

local g1 = createMarker (1517.796, -694.59, 92.00, "cylinder", 3.0, 184,0,0, 150)

addEventHandler ("onClientKey", root, function (btn, press)
    if isElementWithinMarker (localPlayer, g1) and press then
        if btn == "e" then 
            createVehicle (402, 1517.172, -690.4, 94.75, 0, 0, 100)
        end
    end
end)
  • pressOrRelease: This refers to whether they were pressing or releasing the key, true when pressing, false when releasing.

É necessário verificar se a tecla esta pressionada ou solta.

Obrigado! Porem ele esta spawnando o veiculo mas não estou conseguindo entrar. É bug do meu mta ou do codigo?

Link to comment
  • Other Languages Moderators

Veículos criados client-side servem somente para visualização. Não são utilizáveis pelos jogadores.

Quote

Note: Vehicles (and other elements) created client-side are only seen by the client that created them, aren't synced and players cannot enter them. They are essentially for display only.

 

Edited by Lord Henry
  • Thanks 1
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...