kick log and banlog
 

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

kick log and banlog

Started by gizmo, 16 January, 2004, 18:03:28

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gizmo

HI can someone tell if its impossible to make a script who logs who banned and reason and the same when the op kicks ?

NightLitch

it's not impossible, Real simple acually.
//NL

gizmo

do you know if there is such script ready ??

NightLitch

can make one easily for ya
//NL

NightLitch

question is how do you want it to look
//NL

NightLitch

#5
try this one real simple:

-- Simple Kick/Ban Log -Bot
-- By: NightLitch 2004
---------------------------------------------
BotName = "T-Rage"
---------------------------------------------
BanLog = "banlog.txt"
KickLog = "kicklog.txt"
---------------------------------------------
Time = ""..date("%d").."/"..date("%m").."-"..date("%Y")..""
---------------------------------------------
function DataArrival(curUser, data) 
	if (strsub(data, 1, 1) == "<" ) then 
		data=strsub(data,1,strlen(data)-1) 
		local _,_,cmd=strfind(data, "%b<>%s+(%S+)") 
		if not cmd then cmd = "0" end 
		cmd = strlower(cmd) 
		if (cmd == "!ban") then
			ComFunc(curUser,data,"!ban",BanLog)
			return 1
		elseif (cmd == "!kick") then
			ComFunc(curUser,data,"!kick",KickLog)
			return 1
		end
	end
end 
---------------------------------------------
function ComFunc(curUser,data,command,file)
	local s,e,nick,reason = strfind( data, "%b<>%s+%S+%s+(%S+)%s*(.*)" )
	if nick == nil or nick == "" then
		curUser:SendData(BotName,"*** Syntax error in command "..command.."  [reason]: No parameter given.")
		return 1
	end
	local vUser = GetItemByName(nick)
	if not vUser then
		curUser:SendData(BotName,nick.." is not online or wrong name...")
		return 1
	end
	if (rule == nil or rule == "") then rule = "Not given"
	else rule = ""..rule
	end
	if command == "!kick" then 
	sc = "kicked" 
	elseif command == "!ban" then 
	sc = "banned" 
	end
	Msg = Time.."  |  "..vUser.sName.." is "..sc.." by: "..curUser.sName..", becouse: "..reason.." \n"
	writeto(file) 
	write(Msg)
	writeto()
	vUser:SendPM(BotName,"You are being "..sc.." by "..curUser.sName..", because: "..reason)
	SendToAll(BotName,curUser.sName.." is "..sc.." "..nick..", reason: "..reason)
	if sc == "kicked" then
		vUser:TempBan()
	elseif sc == "banned" then
		vUser:Ban()
	end
end
-- By: NightLitch

If you want anything changed just tell me...
//NL

gizmo

like this if its possible  

!banlog  shows  [nick] bannade  by op whos banned and reason  and date

!kicklog   and the same here but kicked

NightLitch

sure can add it later have to go out be back later... but fix it.. np
//NL

NightLitch

test the bot aleast so I now you're happy with it so far... :-)
//NL

Stravides

only problem is that this script seems to replace the value in it, i would expect to see 2 lines for 2 kicks for the same user...  can this be ammended
 :)
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

NightLitch

k I missed a part... sry guys...
//NL

NightLitch

#11
here is a little fix til I add the Viewing part

* UPDATED * Again

-- Simple Kick/Ban Log -Bot
-- By: NightLitch 2004
-- Made some fixes
---------------------------------------------
BotName = "T-Rage"
---------------------------------------------
BanLog = "banlog.txt"
KickLog = "kicklog.txt"
---------------------------------------------
Time = ""..date("%d").."/"..date("%m").."-"..date("%Y")..""
---------------------------------------------
function DataArrival(curUser, data) 
	if (strsub(data, 1, 1) == "<" ) then 
		data=strsub(data,1,strlen(data)-1) 
		local _,_,cmd=strfind(data, "%b<>%s+(%S+)") 
		if not cmd then cmd = "0" end 
		cmd = strlower(cmd) 
		if (cmd == "!ban") and curUser.bOperator then
			ComFunc(curUser,data,"!ban",BanLog)
			return 1
		elseif (cmd == "!kick") and curUser.bOperator then
			ComFunc(curUser,data,"!kick",KickLog)
			return 1
		end
	end
end 
---------------------------------------------
function ComFunc(curUser,data,command,file)
	local s,e,nick,reason = strfind( data, "%b<>%s+%S+%s+(%S+)%s*(.*)" )
	if nick == nil or nick == "" then
		curUser:SendData(BotName,"*** Syntax error in command "..command.."  [reason]: No parameter given.")
		return 1
	end
	local vUser = GetItemByName(nick)
	if not vUser then
		curUser:SendData(BotName,nick.." is not online or wrong name...")
		return 1
	end
	if (rule == nil or rule == "") then rule = "Not given"
	else rule = ""..rule
	end
	if command == "!kick" then 
	sc = "kicked" 
	elseif command == "!ban" then 
	sc = "banned" 
	end
	Msg = ""..vUser.sName.." | "..sc.." | "..curUser.sName.." |"..reason.." | "..Time..""
	local handle = openfile(file, "a")
	write(handle,Msg.."\r\n")
	closefile(handle)
	vUser:SendPM(BotName,"You are being "..sc.." by "..curUser.sName..", because: "..reason)
	SendToAll(BotName,curUser.sName.." is "..sc.." "..nick..", reason: "..reason)
	if sc == "kicked" then
		vUser:TempBan()
	elseif sc == "banned" then
		vUser:Ban()
	end
end
-- By: NightLitch

*UPDATED* Again

hope this one works ;-)
//NL

Stravides

Sorry, Still overwriting

heres the output, tested on a second dc++K client Mal
and used the script from DC++ op acct,.

i get this
16/01-2004 | Mal | kicked | Stravides |kasjdhflkasdf


would it be different if the time was added to the date, or file append used ?
 however you do that ??

:)
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

NightLitch

hehe... what a miss of me...

above code is updated...
//NL

NightLitch

DAMN.. still not working...
//NL

gizmo

I can not find the txt files where is it in /scripts ?

gizmo

does it works with kickban to ??

NightLitch

yepp directly in script folder... just create a folder log

and replace with

BanLog = "log/banlog.txt"
KickLog = "log/kicklog.txt"

above code updated again now it changes line
//NL

NightLitch

will update in later now, gonna catch some TV. l8r
//NL

Stravides

Whoohoo Works :)  
I've formatted to include time too :)

Thanks matey :)
Stravides
For RPG Books, Mp3 & Videos
We host trivia  and the ever failing Smeagolbot

gizmo

now its works but when they right click kick  $Kick its not logs the kick.

NightLitch

I think I'Am getting tired... nothing seams to get right now... F***... sry...

Plop help ME!

-- Simple Kick/Ban Log -Bot
-- By: NightLitch 2004
-- Made some fixes
---------------------------------------------
BotName = "T-Rage"
---------------------------------------------
BanLog = "banlog.txt"
KickLog = "kicklog.txt"
BanTable = {}
KickTable = {}
---------------------------------------------
Time = ""..date("%d").."/"..date("%m").."-"..date("%Y")..""
---------------------------------------------
function DataArrival(curUser, data) 
	if (strsub(data, 1, 1) == "<" ) then 
		data=strsub(data,1,strlen(data)-1) 
		local _,_,cmd=strfind(data, "%b<>%s+(%S+)") 
		if not cmd then cmd = "0" end 
		cmd = strlower(cmd) 
		if (cmd == "!ban") and curUser.bOperator then
			ComFunc(curUser,data,"!ban",BanLog)
			return 1
		elseif (cmd == "!kick") and curUser.bOperator then
			ComFunc(curUser,data,"!kick",KickLog)
			return 1
		elseif (cmd == "!getban") and curUser.bOperator then
			ShowLogs(curUser,data,"!getban","banned")
			return 1
		end
	end
end 
---------------------------------------------
function ComFunc(curUser,data,command,file)
	local s,e,nick,reason = strfind( data, "%b<>%s+%S+%s+(%S+)%s*(.*)" )
	if nick == nil or nick == "" then
		curUser:SendData(BotName,"*** Syntax error in command "..command.."  [reason]: No parameter given.")
		return 1
	end
	local vUser = GetItemByName(nick)
	if not vUser then
		curUser:SendData(BotName,nick.." is not online or wrong name...")
		return 1
	end
	if (rule == nil or rule == "") then rule = "Not given"
	else rule = ""..rule
	end
	if command == "!kick" then 
	sc = "kicked" 
	elseif command == "!ban" then 
	sc = "banned" 
	end
	Msg = ""..vUser.sName.." $ "..sc.."|"..curUser.sName.."|"..Time.."|"..reason
	local handle = openfile(file, "a")
	write(handle,Msg.."\r\n")
	closefile(handle)
	vUser:SendPM(BotName,"You are being "..sc.." by "..curUser.sName..", because: "..reason)
	SendToAll(BotName,curUser.sName.." is "..sc.." "..nick..", reason: "..reason)
	if sc == "kicked" then
		vUser:TempBan()
	elseif sc == "banned" then
		vUser:Ban()
	end
end

function ShowLogs(curUser,data,command,dora)
	local s,e,nick = strfind( data, "%b<>%s+%S+%s+(%S+)" )
	if nick == nil or nick == "" then
		curUser:SendData(BotName,"*** Syntax error in command "..command.." : No parameter given.")
		return 1
	end
------------------------------- THIS PART FUCKS UP-------------------------
	LoadTable(BanTable,BanLog)
	for vNick,vInfo in BanTable do
		local s,e,reason = strfind( vInfo, "%S+|%S+|%S+|(.*)")
		SendToAll("Reason: "..reason)
	end
------------------------------- THIS PART FUCKS UP-------------------------
end
	
function LoadTable(table,file)
	local handle = openfile(file, "r")
	if (handle) then
    		local line = read(handle)
    		while line do
			s,e,ind,val = strfind( line, "(.*) $ (.*)")
			table[ind]=val
			line = read(handle)
    		end
  		closefile(handle)
	end
end
-- By: NightLitch

think you see my problem m8... I have never had this problem... think I Am gonna need to take more lessons from you
about strfind and so on... this sucks... BIG!

pls help me out...
//NL

NightLitch

AM CRYING HERE!!!

Damn I feel I SUCK... have done it over and over time after time...

But now IT FU**s up...

I quit... :-/

don't mean that but... gggaahhh...
//NL

gizmo

hehe take the time you want =)) its no hurry

gizmo


SMF spam blocked by CleanTalk