PtokaX forum

Archive => Archived 5.1 boards => Conversion Requests => Topic started by: Yahoo on 27 November, 2007, 13:26:04

Title: Time Ban Conversion
Post by: Yahoo on 27 November, 2007, 13:26:04
sumbody please convert this script for lua5.1

--Kick as in Verli: !kick user reason _ban_ time unit
--Hungarista 2oo6
--1.00 version

sBot = frmHub:GetHubBotName()

function ChatArrival(curUser,data)
data = string.sub(data,1,string.len(data)-1)
if curUser.bOperator then
if string.find(data,"%b<>%s!kick") then
local s,e,nick,reason,stime,sdate = string.find(data,"%b<>%s!kick%s(%S+)%s*(.*)%s*_ban_%s*(%d+)%s*(%S+)")
user = GetItemByName(nick)
if user == nil then curUser:SendData(sBot,"No user on hub "..nick.."") return 1 end
if stime == nil and sdate  == nil then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_5m")
user:TimeBan(5)
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: 5mins 0sec")
end
if sdate == "s" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
user:Disconnect()
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: 0mins "..stime.."sec")
elseif sdate == "m" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: 0hours "..stime.."min")
user:TimeBan(stime)
elseif sdate == "h" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: 0days "..stime.."hour")
user:TimeBan(stime*60)
elseif sdate == "d" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: "..stime.."day")
user:TimeBan(stime*60*24)
elseif sdate == "w" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: "..stime.."week")
user:TimeBan(stime*60*24*7)
elseif sdate == "M" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: "..stime.."Month")
user:TimeBan(stime*60*24*7*4)
elseif sdate == "y" then
user:SendPM(sBot,"<"..curUser.sName.."> You are being kicked because: "..reason.."_ban_"..stime..""..sdate.."")
curUser:SendData(sBot,"Kicked user "..user.sName.." IP: "..user.sIP.." .. ;)\r\n"..
"and he is being Banned For: "..stime.."year")
user:TimeBan(stime*60*24*7*4*12)
else curUser:SendData(sBot,"No parameter "..sdate..". Avaible parameters are:\r\n"..
"s - secundum\r\n"..
"m - minute\r\n"..
"h - hour\r\n"..
"d - day\r\n"..
"w - week\r\n"..
"M - month\r\n"..
"y - year\r\n")
end
return 1
end
else curUser:SendData(sBot,"You are not allowed to use this command!")
return 1
end
end



and also tell me the command to use this script


thanks in advance
Title: Re: Time Ban Conversion
Post by: Yahoo on 28 November, 2007, 11:16:24
ty mutor
the script is working fine but when a user is ban it does not show reason to ban user it shows only
Sorry you have temp ban with remaining time: 23 hours 59 min 36 sec
IP: 172.16.7.150
Nick: test
it will be better if the user is showed ban with reason

i will like to have sum small changes if possible
1) offline users must also be able to ban
2) command to unban a ban user
3) Right click Command


The following request is specially for mutor
if a user is banned by using this script cant the name of the banned user be shown automatically in sticky message on message board with reason and time of tht ban for eg
User test banned for chat flooding for 24 hours
       (nick)      +          (reason)     +    (time)

Thanks in advace