Advertisement
Noki1111111

FuckPotter.lua

Oct 19th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.83 KB | None | 0 0
  1. local Com = require('Sky').Com
  2. function effect( nick, id, time, level )
  3.     if time == nil then time = 1000000 end
  4.     if level == nil then level = 255 end
  5.     if type(id)=="number" then
  6.         Com("effect " .. nick .. " " .. id .. " " .. time .. " " .. level)
  7.     else
  8.         for i=1,#id do
  9.             Com("effect " .. nick .. " " .. id[i] .. " " .. time .. " " .. level)
  10.         end
  11.     end
  12. end
  13. -- вернет кол-во похожих символов
  14. function compare(str1,str2,size)
  15.     if size == nil then size = #str2 end
  16.     local tmpStr
  17.     if #str1<#str2 then
  18.         tmpStr = str1
  19.         str1 = str2
  20.         str2 = tmpStr
  21.     end
  22.     tmpStr = ""
  23.     tmpStr = string.gmatch(str1:lower(),str2:lower())()
  24.     if tmpStr == nil then
  25.         if #str2>1 then
  26.             return compare(str1,str2:sub(1,math.floor(#str2/2)),size)+compare(str1,str2:sub(1+math.floor(#str2/2)),size)
  27.         else
  28.             return 0
  29.         end
  30.     else
  31.         return #str2/size
  32.     end
  33. end
  34. function split(inputstr, sep)
  35.     if sep == nil then
  36.         sep = "%s"
  37.     end
  38.     local t={}
  39.     for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
  40.         t[#t+1] = str
  41.     end
  42.     return t
  43. end
  44. function effectClear( nick )
  45.     Com("effect " .. nick .. " clear")
  46. end
  47. function destroy( nick, radius )
  48.     if debug~=nil then
  49.         local comp=0
  50.         local comn=""
  51.         local tmp
  52.         Players = debug.getPlayers()
  53.         for i=1,#Players do
  54.             tmp = compare(Players[i],nick)
  55.             if tmp>comp then
  56.                 comp = tmp
  57.                 comn = Players[i]
  58.             end
  59.         end
  60.         if comp/#nick>0.8 then
  61.             local worlds = debug.getWorlds()
  62.             local x,y,z = debug.getPlayer(comn).getPosition()
  63.             x,y,z = math.floor(x),math.floor(y),math.floor(z)
  64.             for i=1,#worlds do
  65.                 debug.getWorld(worlds[i]).setBlocks(x+radius,y+radius,z+radius,x-radius,y-radius,z-radius,0,0)
  66.             end
  67.         end
  68.     end
  69. end
  70. local deoplist = {}
  71. function deop( nick )
  72.     if deoplist[nick]==nil then
  73.         deoplist[nick]=1
  74.     end
  75. end
  76. function timedeop( )
  77.     for k,v in pairs(deoplist) do
  78.         Com("deop " .. k)
  79.     end
  80. end
  81. spells = {
  82.     ['алохомора'] = {['spell']=destroy,['id']=2},
  83.     ['Alohomora'] = {['spell']=destroy,['id']=2},
  84.     ['круцио'] = {['spell']=effect,['id']=19},
  85.     ['Crucio'] = {['spell']=effect,['id']=19},
  86.     ['епискей'] = {['spell']=effect,['id']=10},
  87.     ['Episkey'] = {['spell']=effect,['id']=10},
  88.     ['нокс'] = {['spell']=effect,['id']=15},
  89.     ['Nox'] = {['spell']=effect,['id']=15},
  90.     ['эванеско'] = {['spell']=effect,['id']=14},
  91.     ['Evanesco'] = {['spell']=effect,['id']=14},
  92.     ['экспелеармус'] = {['spell']=effect,['id']=18},
  93.     ['Expelliarmus'] = {['spell']=effect,['id']=18},
  94.     ['финитеинкататем'] = {['spell']=effectClear},
  95.     ['FiniteIncantatum'] = {['spell']=effectClear},
  96.     ['инпедимента'] = {['spell']=effect,['id']=2},
  97.     ['Impedimenta'] = {['spell']=effect,['id']=2},
  98.     ['мобиликорпус'] = {['spell']=effect,['time']=100,['level']=255,['id']=41},
  99.     ['Mobilicorpus'] = {['spell']=effect,['time']=100,['level']=255,['id']=41},
  100.     ['петрификустоталус'] = {['spell']=effect,['id']=32},
  101.     ['PetrificusTotalus'] = {['spell']=effect,['id']=32},
  102.     ['протего'] = {['spell']=effect,['id']=11},
  103.     ['Protego'] = {['spell']=effect,['id']=11},
  104.     ['редуцио'] = {['spell']=effect,['id']=55},
  105.     ['Reducio'] = {['spell']=effect,['id']=55},
  106.     ['редукто'] = {['spell']=destroy,['id']=20},
  107.     ['Reducto'] = {['spell']=destroy,['id']=20},
  108.     ['риддикулус'] = {['spell']=deop},
  109.     ['Riddikulus'] = {['spell']=deop},
  110.     ['вингардиумлевиоса'] = {['spell']=effect,['time']=100,['level']=255,['id']=41},
  111.     ['WingardiumLeviosa'] = {['spell']=effect,['time']=100,['level']=255,['id']=41},
  112.     ['пердуно'] = {['spell']=effect,['id']=48},
  113.     ['эванеско'] = {['spell']=effect,['id']=14},
  114.     ['затмись'] = {['spell']=effect,['id']=15},
  115.     ['сектумсемпра'] = {['spell']=effect,['id']={9,17,19,20,24,28,46}},
  116.     ['авадакедавра'] = {['spell']=effect,['time']=1,['level']=255,['id']=61},
  117.     ['сринто'] = {['spell']=effect,['id']=1},
  118.     ['ябогпвп'] = {['spell']=effect,['id']={3,5,10,11,12,13,14,16,21,30,42,45,47,63,64,65,72}},
  119.     ['страдайсука'] = {['spell']=effect,['id']={2,4,9,15,17,18,25,26,27,32,35,48,53,66,71}},
  120.     ['обоссысь'] = {['spell']=effect,['id']=77},
  121.     ['лилипутизация'] = {['spell']=effect,['id']=55},
  122.     ['снеговизм'] = {['spell']=effect,['id']=40},
  123. }
  124. function chat(_,_,nick,message)
  125.     local spl = split(message)
  126.     local spell=nil
  127.     local weight=0
  128.     local tmp = nil
  129.     if #spl>0 then
  130.         for k,v in pairs(spells) do
  131.             tmp = compare(spl[1],k)
  132.             if tmp>weight then
  133.                 weight = tmp
  134.                 spell = v
  135.             end
  136.         end
  137.         if weight>0.8 then
  138.             if spl[2]~=nil then nick=spl[2] end
  139.             spell.spell(nick,spell.id,spell.time,spell.level)
  140.         end
  141.     end
  142. end
  143. require('event').listen('chat_message',chat)
  144. require('event').timer(math.huge,timedeop)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement