Pushok

deathmatch map configer

Aug 8th, 2011
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. function split(str, c) -- from internet
  2.     a = string.find(str, c)
  3.     str = string.gsub(str, c, "", 1)
  4.     aCount = 0
  5.     start = 1
  6.     array = {}
  7.     last = 0
  8.  
  9.     while a do
  10.         array[aCount] = string.sub(str, start, a - 1)
  11.         start = a
  12.         a = string.find(str, c)
  13.  
  14.         str = string.gsub(str, c, "", 1)
  15.         aCount = aCount + 1
  16.     end
  17.  
  18.     return array
  19. end
  20.  
  21. for line in io.lines("maplist.txt") do
  22.         if line ~= nil then
  23.             str = split( line, "_" )[1]
  24.  
  25.             if str == 'aim' or str == 'deagle' then
  26.                 local f = io.open(line..'.equip.txt', "w+")
  27.  
  28.                 for line1 in io.lines('aim.txt') do
  29.                     f:write(line1..'\n')
  30.                 end
  31.  
  32.                 f:close()
  33.             else if str == 'awp' then
  34.                 local f = io.open(line..'.equip.txt', "w+")
  35.  
  36.                 for line1 in io.lines('awp.txt') do
  37.                     f:write(line1..'\n')
  38.                 end
  39.                 f:close()
  40.  
  41.             else
  42.                 local f = io.open(line..'.equip.txt', "w+")
  43.  
  44.                 for line1 in io.lines('de.txt') do
  45.                     f:write(line1..'\n')
  46.                 end
  47.  
  48.                 f:close()
  49.             end
  50.  
  51.         end
  52.     end
  53. end
Advertisement
Add Comment
Please, Sign In to add comment