#Paper Posted November 21, 2010 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
#Paper Posted November 24, 2010 Author 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
Michcio Posted November 28, 2010 Posted November 28, 2010 Get all function from the admin's panel. That is a part of this function.
#Paper Posted December 4, 2010 Author 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...
Castillo Posted December 4, 2010 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
#Paper Posted December 4, 2010 Author 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?
Aibo Posted December 4, 2010 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)
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