yMassai Posted May 8, 2012 Share Posted May 8, 2012 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
Stanley Sathler Posted May 8, 2012 Share Posted May 8, 2012 addEventHandler("onClientMarkerHit", carrosMarker, function ( hitPlayer ) if (not isPedInVehicle(hitElement)) then getSetVisible(carrosWindow,true) showCursor(true) end end) Veja se funciona. Link to comment
Stanley Sathler Posted May 8, 2012 Share Posted May 8, 2012 Quando você diz "não dá nenhum efeito", refere-se ao fato de que a GUI abre quando o jogador está no carro ou refere-se ao fato de que a GUI não abre de jeito nenhum (com o jogador dentro ou fora de um veículo)? Link to comment
yMassai Posted May 8, 2012 Author Share Posted May 8, 2012 Quando digo que o argumento utilizado não causa nenhum efeito digo que o jogador dentro ou fora do carro abre o Gui. O objetivo é que não abra quando estiver dentro de um carro, mas isto não ocorre. Link to comment
Stanley Sathler Posted May 8, 2012 Share Posted May 8, 2012 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
yMassai Posted May 8, 2012 Author Share Posted May 8, 2012 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
Stanley Sathler Posted May 8, 2012 Share Posted May 8, 2012 Oh, sem dúvidas. Eu não havia reparado nesse detalhe. Consertando a função, funciona? Link to comment
LooooP Posted May 8, 2012 Share Posted May 8, 2012 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now