Timeban, resolving characters, help
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Timeban, resolving characters, help

Started by NightLitch, 07 January, 2004, 20:31:50

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

NightLitch

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...

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

c h i l l a

#1
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

NightLitch

//NL

plop

QuoteOriginally 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 <----<<

SMF spam blocked by CleanTalk