Jump to content

Painel GUI não é exibido ao passar na marker


Recommended Posts

Esse é o meu script que cria a marker
 

function BuySkin()
    bincoB = createMarker(217.5, -98, 1006, "arrow", 1.5, 255, 0, 0)
    setElementInterior(bincoB, 15) 
    vendedora = createPed(12, 209, -99, 1005, 180)
    setElementInterior(vendedora, 15)
end 
addEventHandler("onClientResourceStart", resourceRoot, BuySkin)

function ShowSkins(player)
    if (source == binco1m and getElementType(player) == "player") then
        exibir()
    end
end
addEventHandler("onClientMarkerHit", resourceRoot, ShowSkins) 

Esse é o meu script que cria toda a interface gui

  
    Painel = guiCreateWindow(838, 320, 375, 331, "PAGUE MENOS", false)
    guiWindowSetSizable(Painel, false)
    guiSetAlpha(Painel, 0.92)
    guiSetProperty(Painel, "CaptionColour", "FFFEEB16")
    guiSetVisible(Painel, false)

    sair = guiCreateButton(269, 288, 92, 33, "Sair", false, Painel)
    guiSetProperty(sair, "NormalTextColour", "FF39EB3D")
    GUIEditor.button[4] = guiCreateButton(9, 288, 97, 33, "Comprar", false, Painel)
    guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF39EB3D")

    GUIEditor.gridlist[3] = guiCreateGridList(9, 27, 352, 257, false, Painel)
    guiGridListAddColumn(GUIEditor.gridlist[3], "Skins", 0.3)
    guiGridListAddColumn(GUIEditor.gridlist[3], "ID", 0.3)
    guiGridListAddColumn(GUIEditor.gridlist[3], "Preço", 0.3)
    for i = 1, 2 do
        guiGridListAddRow(GUIEditor.gridlist[3])
    end
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 1, "skin1", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 2, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 3, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 1, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 2, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 3, "-", false, false)    


function exibir()
    guiSetVisible(Painel, not guiGetVisible(Painel))
    showCursor(guiGetVisible(Painel))
end 

function click()
    if source == sair then 
        exibir()
    end
end 
addEventHandler("onClientGUIClick", resourceRoot, click)

 

O meu problema é que quando eu passo na marker, nada acontece, simplesmente nada, nenhum error é mostrado no meu console

Link to comment

Teste :

local GUIEditor = { 
   button = {},
   gridlist = {},
}

function BuySkin() 
    --/> Criar Marker & Ped
    bincoB = createMarker(217.5, -98, 1006, "arrow", 1.5, 255, 0, 0)
    setElementInterior(bincoB, 15) 
    vendedora = createPed(12, 209, -99, 1005, 180)
    setElementInterior(vendedora, 15)
    addEventHandler("onClientMarkerHit", bincoB, ShowSkins) --/> Movido
	
    --/> Painel GUI
    Painel = guiCreateWindow(838, 320, 375, 331, "PAGUE MENOS", false)
    guiWindowSetSizable(Painel, false)
    guiSetAlpha(Painel, 0.92)
    guiSetProperty(Painel, "CaptionColour", "FFFEEB16")
    guiSetVisible(Painel, false)

    sair = guiCreateButton(269, 288, 92, 33, "Sair", false, Painel)
    guiSetProperty(sair, "NormalTextColour", "FF39EB3D")
    GUIEditor.button[4] = guiCreateButton(9, 288, 97, 33, "Comprar", false, Painel)
    guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF39EB3D")
    addEventHandler("onClientGUIClick", sair, exibir) --/> Movido  

    GUIEditor.gridlist[3] = guiCreateGridList(9, 27, 352, 257, false, Painel)
    guiGridListAddColumn(GUIEditor.gridlist[3], "Skins", 0.3)
    guiGridListAddColumn(GUIEditor.gridlist[3], "ID", 0.3)
    guiGridListAddColumn(GUIEditor.gridlist[3], "Preço", 0.3)
    for i = 1, 2 do
        guiGridListAddRow(GUIEditor.gridlist[3])
    end
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 1, "skin1", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 2, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 3, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 1, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 2, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 3, "-", false, false)    
end 
addEventHandler("onClientResourceStart", resourceRoot, BuySkin)

function ShowSkins ( player, Dimensao )
   if isElement(player) and getElementType(player) == "player" then
      exibir( )
   end
end

function exibir ( )
   guiSetVisible(Painel, not guiGetVisible(Painel))
   showCursor(guiGetVisible(Painel))
end 

 

Edited by Angelo Pereira
  • Thanks 1
Link to comment
4 hours ago, Angelo Pereira said:

Teste :


local GUIEditor = { 
   button = {},
   gridlist = {},
}

function BuySkin() 
    --/> Criar Marker & Ped
    bincoB = createMarker(217.5, -98, 1006, "arrow", 1.5, 255, 0, 0)
    setElementInterior(bincoB, 15) 
    vendedora = createPed(12, 209, -99, 1005, 180)
    setElementInterior(vendedora, 15)
    addEventHandler("onClientMarkerHit", bincoB, ShowSkins) --/> Movido
	
    --/> Painel GUI
    Painel = guiCreateWindow(838, 320, 375, 331, "PAGUE MENOS", false)
    guiWindowSetSizable(Painel, false)
    guiSetAlpha(Painel, 0.92)
    guiSetProperty(Painel, "CaptionColour", "FFFEEB16")
    guiSetVisible(Painel, false)

    sair = guiCreateButton(269, 288, 92, 33, "Sair", false, Painel)
    guiSetProperty(sair, "NormalTextColour", "FF39EB3D")
    GUIEditor.button[4] = guiCreateButton(9, 288, 97, 33, "Comprar", false, Painel)
    guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF39EB3D")
    addEventHandler("onClientGUIClick", sair, exibir) --/> Movido  

    GUIEditor.gridlist[3] = guiCreateGridList(9, 27, 352, 257, false, Painel)
    guiGridListAddColumn(GUIEditor.gridlist[3], "Skins", 0.3)
    guiGridListAddColumn(GUIEditor.gridlist[3], "ID", 0.3)
    guiGridListAddColumn(GUIEditor.gridlist[3], "Preço", 0.3)
    for i = 1, 2 do
        guiGridListAddRow(GUIEditor.gridlist[3])
    end
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 1, "skin1", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 2, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 0, 3, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 1, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 2, "-", false, false)
    guiGridListSetItemText(GUIEditor.gridlist[3], 1, 3, "-", false, false)    
end 
addEventHandler("onClientResourceStart", resourceRoot, BuySkin)

function ShowSkins ( player, Dimensao )
   if isElement(player) and getElementType(player) == "player" then
      exibir( )
   end
end

function exibir ( )
   guiSetVisible(Painel, not guiGetVisible(Painel))
   showCursor(guiGetVisible(Painel))
end 

 

Agradeço de coração cara, dessa forma, realmente funcionou, apesar de eu não entender onde errei no primeiro script, mas agradeço mesmo assim ;)

Link to comment

Opa, desculpe, eu lhe informo o erro sim, o erro estava na seguinte linha :

if (source == binco1m and getElementType(player) == "player") then

Está certo, mas, o que esta de errado ai? Nesse caso, o source é o marker que você atingiu, certo?

Então nesse caso, está tentando fazendo o seguinte :

if (source == binco1m) then
--# "source" o MARKER que você colidiu.
--# "binco1m" o MARKER que você quer colidir.
  
--# Então essa verificação, vai verificar se o marker que você quer colidir, é o que você colidiu.
  • Só que o seguinte, o marker que você denominou na criação do seu marker foi "bincoB".
bincoB = createMarker(217.5, -98, 1006, "arrow", 1.5, 255, 0, 0)
  • Então, você precisaria trocar o nome na verificação de "binco1m" para "bincoB" na sua verificação, assim :
if (source == bincoB and getElementType(player) == "player") then

Entende? Espero que sim, o erro só foi esse aparentemente.

  • Like 1
  • 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...