Hugo_Almeidowski Posted January 28, 2019 Share Posted January 28, 2019 (edited) Before I converted this guiWindow to DGS, everything was ok, but now, the peds are not showing. Instead, it shows the ped model in the Name column, the ped dimension in the model column and nothing in the dimension column. If I put the MTA GUI window back, the peds name show. function pedsJanela() pedsJanela = DGS:dgsCreateWindow (0.25, 0.15, 0.30, 0.4, "Peds", true) local listaPeds = DGS:dgsCreateGridList (0, 0.1, 1, 0.75, true, pedsJanela) DGS:dgsWindowSetMovable(pedsJanela, true) DGS:dgsWindowSetSizable(pedsJanela, false) showCursor(true) coluna1 = DGS:dgsGridListAddColumn(listaPeds, "Nome", 0.33) coluna2 = DGS:dgsGridListAddColumn(listaPeds, "Modelo", 0.33) coluna3 = DGS:dgsGridListAddColumn(listaPeds, "Dimensão", 0.33) local all_peds = getElementsByType("ped") for id, ped in ipairs(all_peds) do local ped1name = getElementID(ped) local ped1model = getElementModel(ped) local ped1dimension = getElementDimension(ped) DGS:dgsGridListAddRow(listaPeds, ped1name, ped1model, ped1dimension) end local button = DGS:dgsCreateButton(0.6, 0.87, 0.3, 0.1, "Cancelar", true, pedsJanela) addEventHandler ( "onDgsMouseClick", button, cancelamentoPedsJanela) local button2 = DGS:dgsCreateButton(0.1, 0.87, 0.3, 0.1, "Escolher", true, pedsJanela) addEventHandler ("onDgsMouseClick", button2, escolhaPedsJanela) end addCommandHandler("peds", pedsJanela) I've also noticed that if I gave them an ID that consists only of numbers, they don't even show up in the list. Edited January 28, 2019 by Hugo_Almeidowski Link to comment
DNL291 Posted January 28, 2019 Share Posted January 28, 2019 local all_peds = getElementsByType("ped") for id, ped in ipairs(all_peds) do local ped1name = getElementID(ped) local ped1model = getElementModel(ped) local ped1dimension = getElementDimension(ped) row = DGS:dgsGridListAddRow(listaPeds) DGS:dgsGridListSetItemText ( listaPeds, row, coluna1, ped1name ) DGS:dgsGridListSetItemText ( listaPeds, row, coluna2, ped1model ) DGS:dgsGridListSetItemText ( listaPeds, row, coluna3, ped1dimension ) end Try it. 1 Link to comment
Scripting Moderators thisdp Posted January 28, 2019 Scripting Moderators Share Posted January 28, 2019 (edited) Because onDgsMouseClick triggers twice when you click a button, press and release Edited January 28, 2019 by thisdp Link to comment
Hugo_Almeidowski Posted January 29, 2019 Author Share Posted January 29, 2019 13 hours ago, DNL291 said: local all_peds = getElementsByType("ped") for id, ped in ipairs(all_peds) do local ped1name = getElementID(ped) local ped1model = getElementModel(ped) local ped1dimension = getElementDimension(ped) row = DGS:dgsGridListAddRow(listaPeds) DGS:dgsGridListSetItemText ( listaPeds, row, coluna1, ped1name ) DGS:dgsGridListSetItemText ( listaPeds, row, coluna2, ped1model ) DGS:dgsGridListSetItemText ( listaPeds, row, coluna3, ped1dimension ) end Try it. It worked! Thanks! 1 Link to comment
Scripting Moderators thisdp Posted January 29, 2019 Scripting Moderators Share Posted January 29, 2019 (edited) Ah.. Edited January 29, 2019 by thisdp 1 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