Jump to content

[Problem] gridMaps


pino-boy

Recommended Posts

Posted

Hello,I have a problem in the list of maps

maps no appear :shock:

mta-screen_2013-11-03_03-09-05.png

gridMaps = guiCreateGridList(17,51,315,285,false) 
    guiGridListSetSortingEnabled(gridMaps,false) 
    guiGridListAddColumn(gridMaps,"Map name",0.9) 
addEventHandler ( "onClientGUIClick", gridMaps, updateMapLabels ) 
  
function loadMaps(gamemodeMapTable, gamemode, map) 
    guiGridListClear(gridMaps) 
    if gamemodeMapTable then 
        aGamemodeMapTable = gamemodeMapTable 
        for id,gamemode in pairs (gamemodeMapTable) do 
            if (gamemode.name == "Race") then 
                for id,map in ipairs (gamemode.maps) do 
                    local row = guiGridListAddRow ( gridMaps ) 
                    guiGridListSetItemText ( gridMaps, row, 1, map.name, false, false ) 
                    guiGridListSetItemData ( gridMaps, row, 1, map.resname) 
                    totalServerMaps = totalServerMaps+1 
                    if (string.find(map.name,"[DM]",1,true)) then 
                        totalDmMaps = totalDmMaps+1 
                    elseif (string.find(map.name,"[DD]",1,true)) then 
                        totalDdMaps = totalDdMaps+1 
                    end 
                    updateMapLabels(1) 
                end 
            end 
        end 
    end 
end 
  
function updateMapLabels(updateMode) 
    if updateMode == 1 then 
        guiSetText(lblTotalMapsOnServer,"Total maps on the server: "..totalServerMaps) 
        guiSetText(lblTotalDmMaps,"Total DM Maps:  "..totalDmMaps) 
        guiSetText(lblTotalDdMaps,"Total DD Maps:  "..totalDdMaps) 
    else 
        local row,column = guiGridListGetSelectedItem(gridMaps) 
        local mapName = guiGridListGetItemText(gridMaps,row,1) 
        if mapName == "" then 
            guiSetText(lblSelectedMapName,"N/A") 
            guiSetText(lblSelectedMapAuthor,"N/A") 
        else 
            guiSetText(lblSelectedMapName,mapName) 
            if string.find(mapName,"[DM]",1,true) then 
                guiSetText(lblSelectedMapAuthor,"Deathmatch") 
            elseif string.find(mapName,"[DD]",1,true) then 
                guiSetText(lblSelectedMapAuthor,"Destruction Derby") 
            elseif string.find(mapName,"[FUN]",1,true) then 
                guiSetText(lblSelectedMapAuthor,"Fun map") 
            else 
                guiSetText(lblSelectedMapAuthor,"UNKNOWN") 
            end 
        end 
    end 
end 

Posted

I have had the same problem

But i can say you that you trigger a Server event when the client joins and the server sends a table back to client and save it.

and you have to recreate the table serverside or the client cant read

Posted
I have had the same problem

But i can say you that you trigger a Server event when the client joins and the server sends a table back to client and save it.

and you have to recreate the table serverside or the client cant read

did no understand, what do you mean?

Posted

changed

gridMaps = guiCreateGridList(17,51,315,285,false) 
    guiGridListSetSortingEnabled(gridMaps,false) 
    guiGridListAddColumn(gridMaps,"Map name",0.9) 
    addEventHandler( "onClientGUIClick", gridMaps, loadMaps ) 

Debug

mta-screen_2013-11-03_14-08-25.png

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