Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.26 KB | None | 0 0
  1. function upd_blacklist() -- обновить ЧС
  2.     sampAddChatMessage("[black]{FE9720} Начинаем обновление списка ЧС.", 0x9D6525)
  3.     local path = getGameDirectory() .. '\\moonloader\\blacklist.txt'
  4.     downloadUrlToFile('https://forum.advance-rp.ru/threads/.1542759/', path, function(id, status, p1, p2)
  5.         if status == dlstatus.STATUS_ENDDOWNLOADDATA then
  6.             print('[Blacklist]: Downloaded, preparing..')
  7.             printStringNow("~r~STATUS: ~g~UPDATE", 5000)
  8.             lua_thread.create(function()
  9.                 wait(3000)
  10.                 local f = io.open(path, 'r')
  11.                 local blackF = f:read('*a')
  12.                 f:close()
  13.  
  14.                 if f then
  15.                     print('[Blacklist]: First preparing completed')
  16.                     blackF = blackF:gsub('<.->', '')
  17.                     blackList = io.open(path, 'w')
  18.                     for w in blackF:gmatch('~ZZ~(.-)~ZZEND~') do
  19.                         blackList:write(w)
  20.                     end
  21.                     blackList:close()
  22.                    
  23.                     print('[Blacklist]: Second preparing completed')
  24.                     print('[Blacklist]: Update completed')
  25.                     printStringNow("~r~STATUS: ~g~UPDATE COMPLETED", 3000)
  26.                 else
  27.                     print('[Blacklist]: Preparing error, please, /try again later.')
  28.                     sampAddChatMessage("[black]{FE9720} Произошла ошибка при обновлении списка ЧС.", 0x9D6525)
  29.                 end
  30.             end)
  31.         end
  32.     end)
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement