Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Janhouse on 25 April, 2004, 21:28:27
Title: Temporar ban countdown
Post by: Janhouse on 25 April, 2004, 21:28:27
I have seen this script on robocop. If jou are temporarily banned script shows how long you will be banned. Like this: You are temporarily banned for 6 minutes!
You are temporarily banned for 5 minutes! etc. Can somebody give me that script?
Title:
Post by: nErBoS on 25 April, 2004, 22:57:07
Hi,
That was a time ban, it means that the user was been banned from x time when he tries to recoonect the hub sends how many time as left for his ban.
function DataArrival(user, data) if (strsub(data,1,1)=="<") or (strsub(data,1,5+strlen(Bot))=="$To: "..Bot) then data=strsub(data,1,strlen(data)-1) s,e,cmd = strfind(data,"%b<>%s+(%S+)") if (cmd=="!timeban") then TimeBan(user,data) return 1 end end end
function TimeBan(user,data) if (user.bOperator) then local sec = 1000 local min = sec*60 local h = min*60 local day = h*24 local week = day*7 local month = day*30 local year = day*365 local _,_,usr,number,timeformat,reason = strfind( data, "%b<>%s+%S+%s+(%S+)%s+(%d+)(%S+)%s+(.+)" ) if (usr ~= nil and reason ~= "") then if (GetItemByName(usr) ~= nil) then local tobebanned = GetItemByName(usr) if timeformat == "hours" or timeformat == "hour" or timeformat == "h" then tobebanned:SendPM(Bot, "You have been banned for "..number.." hours because: "..reason) SendToAll(Bot, user.sName.." has banned "..tobebanned.sName.." because: "..reason) tobebanned:TimeBan( (tonumber(number)*h)/min ) elseif timeformat == "days" or timeformat == "day" or timeformat == "d" then tobebanned:SendPM(Bot, "You have been banned for "..number.." days because: "..reason) SendToAll(Bot, user.sName.." has banned "..tobebanned.sName.." because: "..reason) tobebanned:TimeBan( (tonumber(number)*day)/min ) elseif timeformat == "weeks" or timeformat == "week" or timeformat == "w" then tobebanned:SendPM(Bot, "You have been banned for "..number.." weeks because: "..reason) SendToAll(Bot, user.sName.." has banned "..tobebanned.sName.." because: "..reason) tobebanned:TimeBan( (tonumber(number)*week)/min ) elseif timeformat == "months" or timeformat == "month" or timeformat == "m" then tobebanned:SendPM(Bot, "You have been banned for "..number.." months because: "..reason) SendToAll(Bot, user.sName.." has banned "..tobebanned.sName.." because: "..reason) tobebanned:TimeBan( (tonumber(number)*month)/min ) elseif timeformat == "years" or timeformat == "year" or timeformat == "y" then tobebanned:SendPM(Bot, "You have been banned for "..number.." years because: "..reason) SendToAll(Bot, user.sName.." has banned "..tobebanned.sName.." because: "..reason) tobebanned:TimeBan( (tonumber(number)*year)/min ) else user:SendPM(Bot, "The Format you have choose is wrong. For eg: 10h means 10 Hours of ban.") end else user:SendPM(Bot, "The user "..usr.." isn't online") end else user:SendPM(Bot, "Syntax Error, !timeban Best regards, nErBoS