function split(str, c) -- from internet a = string.find(str, c) str = string.gsub(str, c, "", 1) aCount = 0 start = 1 array = {} last = 0 while a do array[aCount] = string.sub(str, start, a - 1) start = a a = string.find(str, c) str = string.gsub(str, c, "", 1) aCount = aCount + 1 end return array end for line in io.lines("maplist.txt") do if line ~= nil then str = split( line, "_" )[1] if str == 'aim' or str == 'deagle' then local f = io.open(line..'.equip.txt', "w+") for line1 in io.lines('aim.txt') do f:write(line1..'\n') end f:close() else if str == 'awp' then local f = io.open(line..'.equip.txt', "w+") for line1 in io.lines('awp.txt') do f:write(line1..'\n') end f:close() else local f = io.open(line..'.equip.txt', "w+") for line1 in io.lines('de.txt') do f:write(line1..'\n') end f:close() end end end end