Author Topic: Timeban, resolving characters, help  (Read 1512 times)

0 Members and 1 Guest are viewing this topic.

Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
Timeban, resolving characters, help
« on: 07 January, 2004, 20:31:50 »
hey guys help me out...

I Have tried made my time ban like this:

!timeban nick reason 3h

but can't get the strfind to be right... plz help hope you
see what I try to accomplish...

Code: [Select]
function dotimeban(curUser,data)
local s,e,cmd,nick,reason,num,val = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s*(.*)%s*(%d*)(%l*)" )
if nick == nil or nick == "" then
curUser:SendTo(BotName,CmdErrorMsg.." "..Prefix.."timeban [reason] [/time(m,h,d)]:"..CmdErrorPar)
return 1
end
if val == "m" then num = tMin
elseif val == "h" then num = tHour
elseif val == "d" then num = tDay
else
curUser:SendTo(BotName,CmdErrorPar)
return 1
end
local vDAYS = tonumber(tDay)*1440
local vHOURS = tonumber(tHour)*60
local vMINS = tonumber(tMin)*1
local days, hours, minutes = floor(mod(vDAYS/1440, 30)), floor(mod(vHOURS/60, 24)), floor(mod(vMINS/1, 60))
if days == nil then days = 0 elseif hours == nil then hours = 0 elseif minutes == nil then minutes = 0
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 or vUser.iProfile == BT.Lvl then
curUser:SendTo(BotName,"***You Can't Kick an Operator or Beta-T")
return 1
else
end
end
KickBanCounter(vUser,BanCounter,sBanFile)
KickBanWriteFile(vUser,reason,BanMsg,sBanMess)

Counter["timban"] = Counter["timban"] + 1
OpKickCounter(curUser,OpKickCount)
vUser:SendPM(BotName,"You are being TimeBanned by "..curUser.sName..", for: "..days.." days, "..hours.." hours, "..minutes.." minutes , Because: "..reason..",  Forum: "..ForumName)
if vDAYS == nil then vDAYS = 0 elseif vHOURS == nil then vHOURS = 0 elseif vMINS == nil then vMINS = 0
end
min = vDAYS+vHOURS+vMINS
-- vUser:TimeBan(min)
SendToAll(BotName,curUser.sName.." is TimeBanning "..nick..", for: "..days.." days, "..hours.." hours, "..minutes.." minutes , Reason: "..reason..",  Forum: "..ForumName)
return 1
end

thx
//NL

PtokaX forum

Timeban, resolving characters, help
« on: 07 January, 2004, 20:31:50 »

Offline c h i l l a

  • Lord
  • ***
  • Posts: 347
  • Karma: +1/-0
(No subject)
« Reply #1 on: 07 January, 2004, 20:43:55 »
nightlitch try to put the reason at last...

or try this

local s,e,cmd,nick,reason,num,val = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)%s+(%d+)(%l)$" )

or this if the pipe is still there

local s,e,cmd,nick,reason,num,val = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)%s+(%d+)(%l)%|$" )

cause thh .*  will use all chars up I think
« Last Edit: 07 January, 2004, 20:47:54 by c h i l l a »

Offline NightLitch

  • Emperor
  • **
  • Posts: 1 455
  • Karma: +16/-0
(No subject)
« Reply #2 on: 07 January, 2004, 21:19:46 »
k, thx Chilla
//NL

Offline plop

  • Forum God
  • ****
  • Posts: 2 464
  • Karma: +37/-0
(No subject)
« Reply #3 on: 08 January, 2004, 00:52:28 »
Quote
Originally posted by c h i l l a
nightlitch try to put the reason at last...

or try this

local s,e,cmd,nick,reason,num,val = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)%s+(%d+)(%l)$" )

or this if the pipe is still there

local s,e,cmd,nick,reason,num,val = strfind( data, "%b<>%s+(%S+)%s+(%S+)%s+(.*)%s+(%d+)(%l)%|$" )

cause thh .*  will use all chars up I think
yep .* goes as big as it can, so you won't get the last/first.
should all be fixed now i gues, nightlitch was in my hub earlyer for help on this.
gave him the same advise as you did, reason as last.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

PtokaX forum

(No subject)
« Reply #3 on: 08 January, 2004, 00:52:28 »