Jump to content

GridList


#Paper

Recommended Posts

How i can imports all maps name in a grid list?

As the admin panel

i did try whit this code, but don't load:

local maps = call(getResourceFromName("mapmanager"), "getMapsCompatibleWithGamemode" , race) 
for id, map in ipairs (maps) do 
local row = guiGridListAddRow ( list ) 
guiGridListSetItemText ( list, row, names, maps, false, false ) 
end 

Edited by Guest
Link to comment

i've made a map shop system long ago, here is the map list function.

function mapsList() 
local resourceTable = getResources() 
     for resourceKey, resourceValue in ipairs(resourceTable) do 
          local name = getResourceName(resourceValue) 
          local type = getResourceInfo ( resourceValue, "type" ) 
          if type == "map" then 
          triggerClientEvent ( "sendMaps", getRootElement(), name) 
          else 
          cancelEvent() 
        end 
    end 
end 

Link to comment
i've made a map shop system long ago, here is the map list function.
function mapsList() 
local resourceTable = getResources() 
     for resourceKey, resourceValue in ipairs(resourceTable) do 
          local name = getResourceName(resourceValue) 
          local type = getResourceInfo ( resourceValue, "type" ) 
          if type == "map" then 
          triggerClientEvent ( "sendMaps", getRootElement(), name) 
          else 
          cancelEvent() 
        end 
    end 
end 

and what do the server client event?

Link to comment
-- server: 
  
function sendMaps(player) 
  local mapTable = {} 
  for i, map in ipairs(exports.mapmanager:getMapsCompatibleWithGamemode(getResourceFromName("race"))) do 
    table.insert(mapTable, getResourceInfo(map, "name")) -- this will add map to list by MAP NAME 
    --table.insert(mapTable, getResourceName(map)) -- this will add map by its RESOURCE NAME 
  end 
  triggerClientEvent(player, "mapListUpdate", getRootElement(), mapTable) 
end 
  
-- client: 
  
addEvent("mapListUpdate", true) 
addEventHandler("mapListUpdate", getRootElement(),  
function(maps) 
  guiGridListClear(list) 
  for i, map in ipairs(maps) do 
    local row = guiGridListAddRow(list) 
    guiGridListSetItemText(list, row, names, map, false, false) 
  end 
end) 

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