lopezloo

[MTASA] Simple IPL lodaer.

Oct 1st, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- IPL loader by lopezloo, FCEB purpose.
  2.  
  3. local iplList = {
  4.     "countn2"
  5. }
  6.  
  7. local output = {}
  8.  
  9. for k, v in pairs(iplList) do
  10.     if fileExists(v .. ".ipl") then
  11.         outputServerLog("IPL-LOADER: Scanning \"" .. v .. "\".")
  12.         local ipl = fileOpen(v .. ".ipl")
  13.         if ipl then
  14.             output[v] = {}
  15.             local data = fileRead(ipl, fileGetSize(ipl))
  16.  
  17.             local instPosStart = string.find(data, "inst")
  18.             local instPosEnd = string.find(data, "end")
  19.             if not instPosStart or not instPosEnd then
  20.                 outputServerLog("ERROR: Can't find INST tag.")
  21.                 return
  22.             end
  23.  
  24.             data = string.sub(data, instPosStart + string.len("inst\n"), instPosEnd - 1)
  25.             local lines = split(data, "\n")
  26.             for k2, v2 in pairs(lines) do
  27.                 output[v][k2] = split(v2, ", ")
  28.                 outputServerLog(output[v][k2][1] .. ", " .. output[v][k2][4] .. ", " .. output[v][k2][5] .. ", " .. output[v][k2][6] .. ", " .. tonumber(output[v][k2][9]))
  29.             end
  30.         end
  31.  
  32.     else
  33.         outputServerLog("IPL-LOADER: \"" .. v .. "\" doesn't exist.")
  34.     end
  35. end
Advertisement
Add Comment
Please, Sign In to add comment