Jump to content

Recommended Posts

addEventHandler ( "onClientMarkerHit", carrosMarker, 
    function ( hitPlayer ) 
if(not isPedInVehicle(localPlayer))then 
    if(hitPlayer == localPlayer)then 
        getSetVisible(carrosWindow,true) 
        showCursor(true) 
          end 
     end 
end) 

Eu estava tentando esta função para que o jogador não abra o Gui quando estiver dentro de um carro, mas não da nenhum efeito.

Alguém poderia ajudar?

Link to comment
addEventHandler("onClientMarkerHit", carrosMarker, 
    function ( hitPlayer ) 
        if (not isPedInVehicle(hitElement)) then 
                getSetVisible(carrosWindow,true) 
                showCursor(true) 
         end 
    end) 

Veja se funciona.

Link to comment

Entendi. É porque tinha ficado meio perdido, rs. De qualquer forma, então tente este:

* Obs: como não tenho a GUI, fica complicado testar. Se puder disponibilizá-la para nós (caso desta vez não funcione)

addEventHandler("onClientMarkerHit", carrosMarker, 
    function ( hitElement ) -- Mudei para "hitElement", pois estava "hitPlayer" 
        if(getElementType(hitElement) == "player") then -- Se o tipo do elemento for um "player" e nao um veiculo 
            if (not isPedInVehicle(hitElement)) then 
                getSetVisible(carrosWindow,true) 
                showCursor(true) 
            end 
        end 
    end) 

Link to comment
carrosWindow = guiCreateWindow(100,100,175,200,"Criador de Carros",false) 
carrosList = guiCreateGridList ( 0.05, 0.10, 0.9, 0.7, true, carrosWindow) 
column = guiGridListAddColumn( carrosList, "Carros", 0.85 ) 
carrosCreate = guiCreateButton(05,170,85,45,"Criar",false,carrosWindow) 
carrosClose = guiCreateButton(110,170,50,45,"Feichar",false,carrosWindow) 
guiWindowSetSizable( carrosWindow,false) 
guiSetVisible( carrosWindow, false ) 
  
carrosMarker = createMarker( 1507.860, -1714.509, 13.046, "cylinder", 1.5, 255, 250,110,100 ) 
  
    function elMarker( hitPlayer ) 
         if ( hitPlayer == localPlayer ) then 
                guiSetVisible ( carrosWindow, true ) 
        showCursor(true) 
         end 
    end 
addEventHandler ( "onClientMarkerHit", carrosMarker, elMarker) 
  
addEventHandler("onClientMarkerHit", carrosMarker, 
    function ( hitElement ) 
        if(getElementType(hitElement) == "player") then 
            if (not isPedInVehicle(hitElement)) then 
                getSetVisible(carrosWindow,true) 
                showCursor(true) 
            end 
        end 
    end) 

Eu retirei uma parte mas com isso irá funcionar para testar.

Repare no:

 getSetVisible(carrosWindow,true) 
                showCursor(true) 

Não deveria ser:

guiSetVisible (carrosWindow, true ) 
        showCursor(true) 

??

Link to comment
addEventHandler('onClientResourceStart', getResourceRootElement(getThisResource()), function () 
    carrosWindow = guiCreateWindow ( 100, 100, 175, 200, "Criador de Carros", false ) 
    carrosList = guiCreateGridList ( 0.05, 0.10, 0.9, 0.7, true, carrosWindow ) 
    column = guiGridListAddColumn ( carrosList, "Carros", 0.85 ) 
    carrosCreate = guiCreateButton ( 05, 170, 85, 45, "Criar", false, carrosWindow ) 
    carrosClose = guiCreateButton ( 110, 170, 50, 45, "Feichar", false, carrosWindow ) 
    guiWindowSetSizable ( carrosWindow, false ) 
    carrosMarker = createMarker ( 1507.860, -1714.509, 13.046, "cylinder", 1.5, 255, 250, 110, 100 ) 
    --guiSetVisible( carrosWindow, false ) 
end) 
  
addEventHandler('onClientMarkerHit', root, function(hitPlayer) 
    if source == carrosMarker and hitPlayer == localPlayer and not isPedInVehicle ( localPlayer ) then 
        guiSetVisible ( carrosWindow, true ) 
        showCursor ( true ) 
    end 
end) 

Pronto

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