Jump to content

Why is ped name not showing? [DGS]


Recommended Posts

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 by Hugo_Almeidowski
Link to comment
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.

  • Like 1
Link to comment
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!

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