--Account manager v1.11
--By Dessamator
--Request By 6Marilyn6Manson6 (or something like it)
--Commands : !regenable -- to enable an account
-- !regdisable -- to disable an account
-- !regstatus -- to see disabled account
-- !disableprofile -- to disable an account
-- !enableprofile -- to enable an account
-- !dprofiles -- to see disabled account
--Update To Lua 5.1.1 by 6Marilyn6Manson6 21/08/2006
--Added Set Action For AccountManager by 6Marilyn6Manson6 21/08/2006
--Added Set Action For ProfileManager by 6Marilyn6Manson6 21/08/2006
------------------------------------------------------
tReg = {}
tProfiles = {}
file ="accounts.dat"
file1="profiles.dat"
------------------------------------------------------
--Config BotName
BotName = "[ITA]AmanagerP" -- frmHub:GetHubBotName(),
------------------------------------------------------
--Set Action For AccountManager
ActionA = 0 ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban / 4=TempBan / 5=Redirect )
TimeBanA = 20 -- TimeBan Account Minute Period
RDA = "hub.no-ip.org" -- Redirect Hub For Disable Account
------------------------------------------------------
------------------------------------------------------
--Set Action For ProfileManager
ActionP = 0 ( 0=Warn / 1=Disconnect / 2=Kick / 3=Ban / 4=TempBan / 5=Redirect )
TimeBanP = 20 -- TimeBan Profile Minute Period
RDP = "hub.no-ip.org" -- Redirect Hub For Disable Profile
------------------------------------------------------
function Main()
LoadFromFile(file)
LoadFromFile(file1)
if BotName ~= frmHub:GetHubBotName() then
frmHub:RegBot(BotName, 1, "AccountManager 1.11", "")
end
end
------------------------------------------------------
function ChatArrival(user,data)
local data=string.sub(data, 1,-2)
local s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)%s+(%S+)")
if cmd and cmd=="!regdisable" and not(tReg[usr]) then
tReg[usr] = 1
user:SendData(BotName,usr.." has been disabled!")
return 1
elseif cmd and cmd=="!regenable" and (tReg[usr]) then
tReg[usr] =nil
user:SendData(BotName,usr.." has been enabled!")
return 1
elseif cmd and cmd=="!disableprofile" and tonumber(usr) then
tProfiles[usr] = 1
user:SendData(BotName,GetProfileName(usr).." Profile has been disabled!")
return 1
elseif cmd and cmd=="!enableprofile" and tonumber(usr) then
tProfiles[usr] = nil
user:SendData(BotName,GetProfileName(usr).." Profile has been enabled!")
return 1
end
local s,e,cmd,usr=string.find(data,"%b<>%s+(%S+)")
if cmd and cmd=="!regstatus" then
local temp="\r\n\These are the disabled Accounts :\r\n"
for tUser,pos in pairs(tReg) do
temp=temp.."\t\Nick :"..tUser.."\r\n"
end
user:SendData(BotName,temp)
elseif cmd and cmd=="!dprofiles" then
local temp="\r\n\These are the disabled Profiles :\r\n"
for profile,pos in pairs(tProfiles) do
temp=temp.."\t\Profile : "..GetProfileName(profile).."\r\n"
end
user:SendData(BotName,temp)
end
end
------------------------------------------------------
function OnExit()
SaveToFile(file, tReg,"tReg")
SaveToFile(file1, tProfiles,"tProfiles")
end
------------------------------------------------------
function ValidateNickArrival(User, Data)
for usr,pos in pairs(tReg) do
if User.sName == usr then
local action = DoDiscA(User, Data)
return 1
end
end
for profile,pos in pairs(tProfiles) do
if User.iProfile == tonumber(profile) then
local action = DoDiscP(User, Data)
end
end
end
------------------------------------------------------
function DoDiscA(User, Data)
if ActionA==0 then
User:SendPM(BotName,"You are Warned for Account disabled!") return "Warned"
elseif ActionA==1 then
User:SendPM(BotName,"You are Disconnected for Account disabled!")
User:Disconnect() return "Disconnected"
elseif ActionA==2 then
User:SendPM(BotName,"You are Kicked for Account disabled!")
User:TempBan() return "Kicked"
elseif ActionA==3 then
User:SendPM(BotName,"You are Banned for Account disabled!")
User:Ban() return "Banned"
elseif ActionA==4 then
User:SendPM(BotName,"You are TimeBanned for Account disabled!")
User:TimeBan(TimeBanA) return "TimeBanned"
elseif ActionA==5 then
User:SendPM(BotName,"You are Redirect for Account disabled!")
User:Redirect(RDA) return "Redirect"
elseif ActionA~=0 or ActionA~=1 or ActionA~=2 or ActionA~=3 or ActionA~=4 or ActionA~=5 then
User:SendPM(BotName,"Your Account has been disabled!")
return 1
end
end
------------------------------------------------------
function DoDiscP(User, Data)
if ActionP==0 then
User:SendPM(BotName,"You are Warned for Profile disabled!") return "Warned"
elseif ActionP==1 then
User:SendPM(BotName,"You are Disconnected for Profile disabled!")
User:Disconnect() return "Disconnected"
elseif ActionP==2 then
User:SendPM(BotName,"You are Kicked for Profile disabled!")
User:TempBan() return "Kicked"
elseif ActionP==3 then
User:SendPM(BotName,"You are Banned for Profile disabled!")
User:Ban() return "Banned"
elseif ActionP==4 then
User:SendPM(BotName,"You are TimeBanned for Profile disabled!")
User:TimeBan(TimeBanP) return "TimeBanned"
elseif ActionP==5 then
User:SendPM(BotName,"You are Redirect for Profile disabled!")
User:Redirect(RDP) return "Redirect"
elseif ActionP~=0 or ActionP~=1 or ActionP~=2 or ActionP~=3 or ActionP~=4 or ActionP~=5 then
User:SendPM(BotName,"Your Profile has been disabled!")
return 1
end
end
------------------------------------------------------
function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");
assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");
sTab = sTab or "";
sTmp = ""
sTmp = sTmp..sTab..sTableName.." = {\n"
for key, value in pairs(tTable) do
local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
if(type(value) == "table") then
sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end
sTmp = sTmp..",\n"
end
sTmp = sTmp..sTab.."}"
return sTmp
end
------------------------------------------------------
function SaveToFile(file , table , tablename)
local handle = io.open(file,"w+")
handle:write(Serialize(table, tablename))
handle:flush()
handle:close()
end
------------------------------------------------------
function LoadFromFile(file)
local handle = io.open(file,"r")
if (handle ~= nil) then
dofile(file)
handle:flush()
handle:close()
end
end
------------------------------------------------------
--// 6Marilyn6Manson6
wat is this script all about??
VerliHub have 2 commands: !regenable and !regdisable, this script do this 2 commands, do other 2 commands for do this with profile and other 2 commands for see what reg and profile are disabled :)
Hmmm isent this topic abouth Ptokax script :P