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 )

 

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
2 minutes ago, Lord Henry said:

O script é client-side?

Sim, onClientKey é somente client-side.

--

@PlaKS Acho que seja bug no seu MTA.

Share this post


Link to post
1 minute ago, Lord Henry said:

O script é client-side?

sim

 

Just now, Jonas^ said:

Sim, onClientKey é somente client-side.

--

@PlaKS Acho que seja bug no seu MTA.

ok, obrigado

Share this post


Link to post
Posted (edited)

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

Share this post


Link to post

Putz é verdade asuhasuaashuas @Lord Henry nunca criei veículo client-side nem sabia que era apenas ' enfeite '.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.