Request for script !topkickers (!topreggers)
 

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

Request for script !topkickers (!topreggers)

Started by Penguin, 18 June, 2005, 17:32:07

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Penguin

Hi guys,

I'm after a script that will keep a record of who is regging (kicking) users & how many.
 
I want a script like Robocop's !tophubbers & !topkickers so that it will display how many OPs have regged (kicked) new users. Also maybe an option so it'll display top reggers (kickers) per week & per month.

Thanx in advance,
               Penguin

P.S.
I did try search before this post, but I find only one old LUA4 script.
Thank you very much in advance for help with make the script!

Dessamator

so basically u want 2 script, top regger and top kicker?
Ignorance is Bliss.

Penguin

QuoteOriginally posted by Dessamator
so basically u want 2 script, top regger and top kicker?

Yep  :)

Madman

-- TopRegger Script
-- Made by Madman
-- Requested by ph34r

-- Converted to lua 5
-- Striped TopKickers from MadSecurity
-- Made the topkicker more flexible
-- And now also logs more stuff

Bot = frmHub:GetHubBotName()
RegFile = "TopReggers.txt" -- The text to save things in
RegCmd = "addreguser" -- The command to used when regging user, no need to write ! or + before the command
AllowedToReg = { -- Set to 1 for thoose allowed to reg
	[0] = 1,   -- Masters
	[1] = 1,   -- Operators
	[2] = 0,   -- Vips
	[3] = 0,   -- Regs
}
KickFile = "TopKickers.txt" -- The file for topkickers

function Main()
	LoadFromFile(RegFile)
	LoadFromFile(KickFile)
end

function ChatArrival(curUser, data)
local data = string.sub(data,1, -2)
local s,e,cmd = string.find(data, "%b<>%s[%!%+%?%#%+](%S+)") 
	if cmd then
		local tCmds = {
		["topreg"] =  function(curUser, data)
			if curUser.bOperator then
				Msg = "\r\nTop regging ops \r\n\r\nOpertor\tRegged\tCount\tDate & Time\r\n" ..string.rep("-",80).. "\r\n\r\n"
				for Nick,_ in tTopReg do
					Msg = Msg..Nick.."\t"
					for _,Info in tTopReg[Nick] do
						Msg = Msg..Info.."\t"
					end
					Msg = Msg.."\r\n"
				end
				curUser:SendPM(Bot, Msg) return 1
			end
			curUser:SendData(Bot, "You are not allowed to use this command")
		end,
		[RegCmd] = function(curUser, data)
			if AllowedToReg[curUser.iProfile] == 1 then
				local s,e,Nick = string.find(data, "%b<>%s+%S+%s+(%S+)")
				if tTopReg[curUser.sName] == nil then
					tTopReg[curUser.sName] = {}
					tTopReg[curUser.sName]["RegNick"] = {}
					tTopReg[curUser.sName]["LastReg"] = {}
					tTopReg[curUser.sName]["Count"] = {}
					tTopReg[curUser.sName]["RegNick"] = Nick
					tTopReg[curUser.sName]["LastReg"] = os.date("%Y-%m-%d - %X")
					tTopReg[curUser.sName]["Count"] = 1
					SaveToFile(RegFile, tTopReg, "tTopReg")
				else
					tTopReg[curUser.sName]["RegNick"] = Nick
					tTopReg[curUser.sName]["LastReg"] = os.date("%Y-%m-%d - %X")
					tTopReg[curUser.sName]["Count"] = tTopReg[curUser.sName]["Count"] + 1
					SaveToFile(RegFile, tTopReg, "tTopReg")
				end
			end
		end,
		["topkickers"] = function(curUser, data)
			if curUser.bOperator then
				Msg = "\r\nCurrent Top Kicking Ops\r\n\r\nOperator\tDate & Time\t\tCount\tKicked\r\n" ..string.rep("-",90).. "\r\n\r\n"
				for Nick,_ in tTopKickers do
					Msg = Msg..Nick.."\t"
					for _,Info in tTopKickers[Nick] do
						Msg = Msg..Info.."\t"
					end
					Msg = Msg.."\r\n"
				end
				curUser:SendPM(Bot, Msg) return 1
			end
			curUser:SendData(Bot, "You are not allowed to use this command") return 1
		end,
		}
		if tCmds[cmd] then
			return tCmds[cmd](curUser, data)
		end
	end
end

function KickArrival(curUser, data)
	_,_,nick = string.find(data, "%S+%s+(%S+)|")
	vUser = GetItemByName(nick)
	if tTopKickers[curUser.sName] == nil then
		tTopKickers[curUser.sName] = {}
		tTopKickers[curUser.sName]["KickNick"] = {}
		tTopKickers[curUser.sName]["LastKick"] = {}
		tTopKickers[curUser.sName]["Count"] = {}
		tTopKickers[curUser.sName]["KickNick"] = vUser.sName
		tTopKickers[curUser.sName]["LastKick"] = os.date("%Y-%m-%d - %X")
		tTopKickers[curUser.sName]["Count"] = 1
		SaveToFile(KickFile, tTopKickers, "tTopKickers")
	else
		tTopKickers[curUser.sName]["KickNick"] = vUser.sName
		tTopKickers[curUser.sName]["LastKick"] = os.date("%Y-%m-%d - %X")
		tTopKickers[curUser.sName]["Count"] = tTopKickers[curUser.sName]["Count"] + 1
		SaveToFile(KickFile, tTopKickers, "tTopKickers")
	end
end

-- Serialize by nErBoS
function Serialize(tTable, sTableName, sTab)
	assert(tTable, "tTable equals nil");
	assert(sTableName, "sTableName equals nil");
	assert(type(tTable) == "table", "tTable must be a table!");
	assert(type(sTableName) == "string", "sTableName must be a string!");
	sTab = sTab or "";
	sTmp = ""
	sTmp = sTmp..sTab..sTableName.." = {\n"
	for key, value in tTable do
		local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value);
			sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
		end
		sTmp = sTmp..",\n"
	end
	sTmp = sTmp..sTab.."}"
	return sTmp
end

function SaveToFile(file , table , tablename)
	local handle = io.open(file,"w+")
	handle:write(Serialize(table, tablename))
	handle:flush()
	handle:close()
end

function LoadFromFile(RegFile)
	local f = io.open(RegFile)
	if f then
		local r = f:read("*a")
		f:flush()
		f:close()
		local func,err = loadstring(r)
		if func then x,err = pcall(func) end
	end
end
Slightly tested...

Add this to these files

TopReggers.txt
tTopReg = {
}
TopKickers.txt
tTopKickers = {
}
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Krysalis

Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:97: attempt to index global `tTopKickers' (a nil value)
Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:76: attempt to call a nil value
Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:76: attempt to call a nil value
Syntax ....3.0.b17.05.nt.rls\scripts\Trivia-Ex-V.0.68.lua5.lua:1391: attempt to call method `SendToPlayers' (a nil value)
Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:56: attempt to index global `tTopReg' (a nil value)
Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:56: attempt to index global `tTopReg' (a nil value)
Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:56: attempt to index global `tTopReg' (a nil value)
Syntax ...or\Desktop\0.3.3.0.b17.05.nt.rls\scripts\topkick.lua:56: attempt to index global `tTopReg' (a nil value)

How can i fix this?

Dessamator

#5
QuoteOriginally posted by madman
Add this to these files

TopReggers.txt
tTopReg = {
}
TopKickers.txt
tTopKickers = {
}

did u do that?

P.S. That script is in lua 4, it wont work with lua 5
Ignorance is Bliss.

Krysalis

thx dessamator

I make this files. but it seems i need the real LUA5 version. Can anyone translate it or me?

jiten

QuoteOriginally posted by Krysalis
thx dessamator

I make this files. but it seems i need the real LUA5 version. Can anyone translate it or me?
That script is already in Lua 5 m8 ;)

Madman

QuoteOriginally posted by Krysalis
thx dessamator

I make this files. but it seems i need the real LUA5 version. Can anyone translate it or me?

It is in lua 5....
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Dessamator

QuoteOriginally posted by madman
QuoteOriginally posted by Krysalis
thx dessamator

I make this files. but it seems i need the real LUA5 version. Can anyone translate it or me?

It is in lua 5....

ooops, my error, its already in lua 5 , but u are obviously missing something, that error should only appear when a table is missing !
Ignorance is Bliss.

Krysalis

i saw it in the header, anyway^^ I have these syntax errors. I create these 2 txt files and save the text in there.  the 2 txt file i createt in Scripts/txt.
right?

greets

Dessamator

QuoteOriginally posted by Krysalis
i saw it in the header, anyway^^ I have these syntax errors. I create these 2 txt files and save the text in there.  the 2 txt file i createt in Scripts/txt.
right?

greets

Wrong, It should be in the scripts folder !
Ignorance is Bliss.

Krysalis

thx, now it seems to run fine;-)

Greets

Dessamator

Ignorance is Bliss.

jiten

Here goes my attempt ;)

Best regards,

jiten

SMF spam blocked by CleanTalk