-- KVIP script. -- gives some VIPs the right to kick without adding a new profile. -- only masters can add/remove them. -- script requested by: (MM)(nl)rjsconn/rick -- by plop -- name of the bot (doesn't resgister in the userlist). Bot = "sneaky_kick" -- folder where the files are saved (you can't do without it). folder = "vipkick" -- log file name for the kicks. file = "vipkick.log" -- place the name of the opchat for scripted opchat or --frmHub:GetOpChatName() for the ptokax built-in opchat opchat = nil ------------------------------------------ function Main() if readfrom(folder.."/KVIP.lua") then dofile(folder.."/KVIP.lua") readfrom() else tKickingVIPs = {} end end function WriteLog(kicker, victum, reason) appendto(folder.."/"..file) local msg = kicker.." kicked: "..victum.." because of: "..reason if opchat then SendPmToOps(opchat, msg.."|") else SendPmToOps(Bot, msg.."|") end write(msg.."\n") writeto() end function SaveKvip() writeto(folder.."/KVIP.lua") write("tKickingVIPs = {") local t = nil for a,b in tKickingVIPs do write( (t or "").."\n".."\t[\""..a.."\"] = 1" ) if t == nil then t = "," end end write("\n}") writeto() end function DoKick(user, data) local s,e,victum, reason = strfind(data, "%b<>%s+%S+%s*(%S*)%s*(.*)") if victum == "" then return "I need a name to know who to kick!!" elseif reason == "" then return "I need a reason to kick the user!" else local victem = GetItemByName(victum) if victem ~= nil then if victem.iProfile == 3 or victem.iProfile == -1 then WriteLog(user.sName, victum, reason) victem:SendData(Bot, "You have been kicked by: "..user.sName.." because of: "..reason.."|") victem:Kick() return victum.." has been kicked!" else return "We don't kick Operators or VIP's!!" end else return victum.." Isn't in the hub!!" end end end function AddKick(user, data) local s,e,kvip = strfind(data, "%b<>%s+%S+%s*(%S*)") if kvip ~= "" then local KVIP = GetItemByName(kvip) if KVIP ~= nil then if KVIP.iProfile == 2 then tKickingVIPs[KVIP.sName]=1 SaveKvip() return kvip.." can now kick users!" elseif KVIP.iProfile ~= 2 then return kvip.." isn't a VIP!" end else return "Unknown user!" end else return "I need the name of the VIP to be able to add him!" end end function DelKick(user, data) local s,e,kvip = strfind(data, "%b<>%s+%S+%s*(%S*)") if kvip ~= "" then if tKickingVIPs[kvip] then tKickingVIPs[kvip]=nil SaveKvip() return kvip.." can't kick users anymore!" else return kvip.." was no KVIP!" end else return "I need the name of the VIP to be able to remove him!" end end function DataArrival(user, data) if tKickingVIPs[user.sName] then if(strsub(data, 1, 4) == "$To:") then local s,e,whoTo = strfind(data,"$To:%s+(%S+)") if whoTo == Bot then data=strsub(data,1,strlen(data)-1) local s,e,cmd = strfind(data, "%$%b<>%s+(%S+)") if cmd == "!kick" then data = strfind(data, "(%$%b<>.*)") user:SendData(Bot, DoKick(user, data).."|") return 1 end end elseif( strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) local s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd == "!kick" then user:SendData(Bot, DoKick(user, data).."|") return 1 end end elseif user.iProfile == 0 then if(strsub(data, 1, 4) == "$To:") then local s,e,whoTo = strfind(data,"$To:%s+(%S+)") if whoTo == Bot then data=strsub(data,1,strlen(data)-1) local s,e,cmd = strfind(data, "%$%b<>%s+(%S+)") data = strfind(data, "(%$%b<>.*)") if cmd == "!addvipkick" then user:SendData(Bot, AddKick(user, data).."|") return 1 elseif cmd =="!delvipkick" then user:SendData(Bot, DelKick(user, data).."|") return 1 end end elseif( strsub(data, 1, 1) == "<" ) then data=strsub(data,1,strlen(data)-1) local s,e,cmd = strfind(data,"%b<>%s+(%S+)") if cmd == "!addvipkick" then user:SendData(Bot, AddKick(user, data).."|") return 1 elseif cmd =="!delvipkick" then user:SendData(Bot, DelKick(user, data).."|") return 1 end end end end