Jump to content

SQLite Questions|


HustraDev

Recommended Posts

It will be better for you to google it. I'm on phone so I can't write lua code so I copied a code from aibo's post and made some changes.

-- server: 
  
addEvent("IneedMaps", true) 
addEventHandler("IneedMaps", getRootElement(),  
  
function (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: 
  
setTimer(function()triggerServerEvent ("IneedMaps",localPlayer) end,2000,1) 
  
  
local list = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true) 
local column = guiGridListAddColumn( list, "Player", 0.85 ) 
  
addEvent("mapListUpdate", true) 
addEventHandler("mapListUpdate", getRootElement(),  
function(maps) 
  guiGridListClear(list) 
  for i, map in ipairs(maps) do 
    local row = guiGridListAddRow(list) 
    guiGridListSetItemText(list, row, column, map, false, false) 
  end 
end) 

Link to comment
It will be better for you to google it. I'm on phone so I can't write lua code so I copied a code from aibo's post and made some changes.
-- server: 
  
addEvent("IneedMaps", true) 
addEventHandler("IneedMaps", getRootElement(),  
  
function (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: 
  
setTimer(function()triggerServerEvent ("IneedMaps",localPlayer) end,2000,1) 
  
  
local list = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true) 
local column = guiGridListAddColumn( list, "Player", 0.85 ) 
  
addEvent("mapListUpdate", true) 
addEventHandler("mapListUpdate", getRootElement(),  
function(maps) 
  guiGridListClear(list) 
  for i, map in ipairs(maps) do 
    local row = guiGridListAddRow(list) 
    guiGridListSetItemText(list, row, column, map, false, false) 
  end 
end) 

Thanks Man Finally i Get it :D

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