Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sMaps = {}
- sMaps.__index = sMaps
- sMaps.mapTable = {}
- function sortCompareFunction(s1, s2)
- if type(s1) == "table" and type(s2) == "table" then
- s1, s2 = s1.name, s2.name
- end
- s1, s2 = s1:lower(), s2:lower()
- if s1 == s2 then
- return false
- end
- local byte1, byte2 = string.byte(s1:sub(1,1)), string.byte(s2:sub(1,1))
- if not byte1 then
- return true
- elseif not byte2 then
- return false
- elseif byte1 < byte2 then
- return true
- elseif byte1 == byte2 then
- return sortCompareFunction(s1:sub(2), s2:sub(2))
- else
- return false
- end
- end
- function sMaps:load()
- for i, k in ipairs(getResources()) do
- if getResourceInfo(k,"type") == "map" and getResourceInfo(k,"gamemodes") == "race" then
- table.insert(sMaps.mapTable,{mapName = getResourceName(k), mapAuthor = getResourceInfo(k,"author") or "Unknown", uploadTime = getResourceLoadTime(k) or "00.00.0000"})
- end
- end
- outputDebugString(#sMaps.mapTable.." Maps wurden geladen!")
- table.sort(sMaps.mapTable, sortCompareFunction)
- end
- addEvent("sMaps:getList")
- addEventHandler("sMaps:getList", root, function()
- triggerClientEvent(source,"event",root,sMasp.mapTable)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement