#Paper Posted November 21, 2010 Share Posted November 21, 2010 (edited) 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 November 24, 2010 by Guest Link to comment
Aibo Posted November 21, 2010 Share Posted November 21, 2010 where is «gamemode.maps», where is «list»? Link to comment
#Paper Posted November 24, 2010 Author Share Posted November 24, 2010 where is «gamemode.maps», where is «list»? nothing nothing... i did got this code from AdminP but i did try to make my own code, see inn the 1st post Link to comment
Michcio Posted November 28, 2010 Share Posted November 28, 2010 Get all function from the admin's panel. That is a part of this function. Link to comment
#Paper Posted December 4, 2010 Author Share Posted December 4, 2010 Get all function from the admin's panel. That is a part of this function. i did but don't work... Link to comment
Castillo Posted December 4, 2010 Share Posted December 4, 2010 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
#Paper Posted December 4, 2010 Author Share Posted December 4, 2010 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
Aibo Posted December 4, 2010 Share Posted December 4, 2010 -- 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
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