Hey guys.. I want help with this...
This Timeban just ban in minutes... I want to be able to ban days to... hows that possible...
function dotimeban(curUser,data)
s,e,nick,min,reason = strfind(data,"(%S+)%s+(%d*)%s*(.*)")
if (nick == nil or nick == "") then
user:SendTo(BotName,CmdErrorMsg.." "..Prefix.."timeban [min] [reason]:"..CmdErrorPar)
return 1
end
if (min == nil or min == "") then min = 30
else min = ""..min
end
if (reason == "" or reason == nil) then reason = "for no reason"
else reason = ""..reason
end
local vUser = GetItemByName(nick)
if not vUser then
curUser:SendTo(BotName,nick.." is not online or wrong name...")
return 1
end
if KickOperator == "disable" then
if vUser.bOperator then
curUser:SendTo(BotName,"***You Can't Kick an Operator")
return 1
else
end
end
Counter["bans"] = Counter["bans"] + 1
saveTableToFile(sCounterFile, Counter)
vUser:SendPM(BotName,"You are being TimeBanned by "..curUser.sName.." for: >"..min.."< , Because: "..reason)
vUser:TimeBan(min)
SendToAll(BotName,curUser.sName.." is TimeBanning "..nick..", for: >"..min.."< , Reason: "..reason)
return 1
end
or maybe hours... instread of min...
plz help me out...
/NL
Hour = 60*min
TimeBan(Hour)
?
so I can do day like :
Day = 24 * 60 * min
then ???
I can't get it to work like I want... perhaps you can show me
how it's done... in the function... plz...
/NL
function dotimeban(curUser,data)
s,e,nick,min,reason = strfind(data,"(%S+)%s+(%d*)%s*(.*)")
local hour = 60*min
if (nick == nil or nick == "") then
user:SendTo(BotName,CmdErrorMsg.." "..Prefix.."timeban [min] [reason]:"..CmdErrorPar)
return 1
end
if (hour == nil or hour == "") then hour = 1
else hour = ""..hour
end
if (reason == "" or reason == nil) then reason = "for no reason"
else reason = ""..reason
end
local vUser = GetItemByName(nick)
if not vUser then
curUser:SendTo(BotName,nick.." is not online or wrong name...")
return 1
end
if KickOperator == "disable" then
if vUser.bOperator then
curUser:SendTo(BotName,"***You Can't Kick an Operator")
return 1
else
end
end
Counter["bans"] = Counter["bans"] + 1
saveTableToFile(sCounterFile, Counter)
vUser:SendPM(BotName,"You are being TimeBanned by "..curUser.sName.." for: >"..hour.."< , Because: "..reason)
vUser:TimeBan(hour)
SendToAll(BotName,curUser.sName.." is TimeBanning "..nick..", for: >"..hour.."< , Reason: "..reason)
return 1
end
This should work as hours....
if you want days i think you can do as you showed,
or maybe
local hour = 60 * min
local day = 24 * hour
Then if you want to have both hours and days, instead of making a new section you can add an arg between nick,arg ,min,
and then if arg == hour then
--todo
else
But i don't know, there may be another solution that is better
QuoteOriginally posted by kepp
Then if you want to have both hours and days, instead of making a new section you can add an arg between nick,arg ,min,
and then if arg == hour then
--todo
else
But i don't know, there may be another solution that is better
!tempban
[day's] [hours] [mins] [reason] - Ban's a user for the given or default time (15). Reason/time is optional
this is from a.i., as you can see everything beside the nick is optional.
if no number is found it takes the default, if 1 is found minutes, 2 then hours min, 3 days hours mins.
just you have 2 calculate everything 2 minutes.
plop