Hugo_Almeidowski Posted February 8, 2019 Share Posted February 8, 2019 function MarkerHit (localPlayer, dimensao) janelaEmpregos = DGS:dgsCreateWindow (0.015, 0.18, 0.3, 0.3, "Empregos", true) DGS:dgsWindowSetCloseButtonEnabled(janelaEmpregos, false) showCursor(true) DGS:dgsSetInputMode("no_binds_when_editing") DGS:dgsWindowSetSizable(janelaEmpregos, false) local listaEmpregos = DGS:dgsCreateGridList (0.05, 0.03, 0.9, 0.75, true, janelaEmpregos) local coluna1 = DGS:dgsGridListAddColumn(listaEmpregos, "Emprego", 0.5) local coluna2 = DGS:dgsGridListAddColumn(listaEmpregos, "Localização", 0.5) DGS:dgsGridListAddRow(listaEmpregos, 1, "Entregador de Pizza", "San Fierro") DGS:dgsGridListAddRow(listaEmpregos, 2, "Camionista", "San Fierro") DGS:dgsGridListAddRow(listaEmpregos, 3, "Entregador de Pizza", "San Fierro") buttonC = DGS:dgsCreateButton(0.60, 0.815, 0.25, 0.15, "Cancelar", true, janelaEmpregos) addEventHandler ("onDgsMouseClick", buttonC, cancelamentoJanelaEmpregos) buttonE = DGS:dgsCreateButton(0.15, 0.815, 0.25, 0.15, "Escolher", true, janelaEmpregos) addEventHandler ("onDgsMouseClick", buttonE, escolhaJanelaEmpregos) end addEventHandler ( "onClientMarkerHit", agenciaEmpregos, MarkerHit ) function cancelamentoJanelaEmpregos() DGS:dgsCloseWindow(janelaEmpregos) showCursor(false) end function escolhaJanelaEmpregos() outputChatBox("OLA") local selected = DGS:dgsGridListGetSelectedItem(listaEmpregos) if selected == 1 then outputChatBox("lol") end DGS:dgsCloseWindow(janelaEmpregos) showCursor(false) end Why is the second function not working? It sends the first ChaBox (OLA) but then, it doesn't send the second chatbox (lol) If I change selected == 1 to selected ~= 1 it works with every item, including the first one Link to comment
Scripting Moderators thisdp Posted February 8, 2019 Scripting Moderators Share Posted February 8, 2019 why not outputChatBox(selected) ? Link to comment
Hugo_Almeidowski Posted February 9, 2019 Author Share Posted February 9, 2019 19 hours ago, thisdp said: why not outputChatBox(selected) ? What difference does it make if it doesn't even send the message? Link to comment
Scripting Moderators thisdp Posted February 12, 2019 Scripting Moderators Share Posted February 12, 2019 because "listaEmpregos" is a local variable in function "MarkerHit" Link to comment
Peti Posted February 12, 2019 Share Posted February 12, 2019 (edited) If you try what thisdp said, what can you see? Edited February 12, 2019 by Peti 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