Top Op - Ops Reg Stats
 

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

Top Op - Ops Reg Stats

Started by ph34r, 18 June, 2005, 00:58:29

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ph34r

Hey dudes. I had a quick look around the forum for the script im looking for but wasnt able to find it. Lemme explain what i need, then maybe if someone knows a link to it, they can tell me, or a very kind person could make it :)

Basically im looking for a script which works in the same way as RoboCop's Tophubbers and Topkickers list, but i need it for regged users, i need to know how many users each op is registering, so i can monitor how hard they are working.

Hope thats enough... oh yeh, it needs to be LUA 4, and for anyone whos gonna tell me that this sort of script already exists within another bigger script, i need it STANDALONE.

Thanks in advance for ANY help given.

ph34r.

Madman

do you want a seperate command for each profile i.e !regreg, !regvip or should it be !reg ?


This give me a change to learn file handling in lua 4 as well =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

ph34r

nooo its not to reg users, its to register how many OPs have been regging new users.

An Example

!topops

--shows-->

OP NAME                       Users Registered
-----------------------------------------------------
Operator1                               13
Operator2                               17
Operator3                               29
Operator4                                5
Operator5                               16

Like that, but maybe more things, like when they were active etc.

ph34r

that looks good Mutor, but i need it for +TopReggers not top kickers

thanks anyhow :)

Madman

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

Bot = frmHub:GetHubBotName()
Filename = "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
}

function Main()
	LoadFromFile(Filename)
end

function DataArrival(curUser, data)
	if strsub(data, 1, 1) == "<" then
	local data = strsub(data,1, -2)
	local s,e,cmd = strfind(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" ..strrep("-",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 = strfind(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"] = date("%Y-%m-%d - %X")
						tTopReg[curUser.sName]["Count"] = 1
						SaveToFile(Filename, tTopReg, "tTopReg")
					else
						tTopReg[curUser.sName]["RegNick"] = Nick
						tTopReg[curUser.sName]["LastReg"] = date("%Y-%m-%d - %X")
						tTopReg[curUser.sName]["Count"] = tTopReg[curUser.sName]["Count"] + 1
						SaveToFile(Filename, tTopReg, "tTopReg")
					end
				end
			end,
			}
			if tCmds[cmd] then
				return tCmds[cmd](curUser, data)
			end
		end
	end
end

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 format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and 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)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end

Here we go...

In the TopReggers.txt you must add
tTopReg = {
}

Tested some... Seems to work okey.. =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

QuikThinker

Ok we need 3 mods 2 this script if possible.

1) There are 2 reg commands, NOT "addreguser" but "regreg" or "regvip".

2) We need levels to include Moderator and NetFounder.

3) When an OP uses command "!deluser" and deletes a user, mayb if a regging mistake is made, it'll delete that from the txt file to prevent un-neccessary additions.

Thanx in advance,
Quik.

Madman

#6
QuoteOriginally posted by QuikThinker
Ok we need 3 mods 2 this script if possible.

1) There are 2 reg commands, NOT "addreguser" but "regreg" or "regvip".

2) We need levels to include Moderator and NetFounder.

3) When an OP uses command "!deluser" and deletes a user, mayb if a regging mistake is made, it'll delete that from the txt file to prevent un-neccessary additions.

Thanx in advance,
Quik.

1 shouldnt be to hard....
2 is easy...
3 i dont understand exatly...
You want when a op delets the user he just regged, it should remove that nick from the txt?
If so.. I'm not sure i can do it...
Well.. i can remove the nick.. but that will create a nil error...
So instead to the latest nick the op regged, what should it say instead?
It might work... ;)

You want it lua 4 or 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

ph34r

Lua 4 please.

Basically on the counter, say an OP regs 5 people for example, the txt file will display

Opname      5 users registered

but then if he deletes one user, it should say

Opname       4 users registered

is that possible?

Madman

QuoteOriginally posted by ph34r
Lua 4 please.

Basically on the counter, say an OP regs 5 people for example, the txt file will display

Opname      5 users registered

but then if he deletes one user, it should say

Opname       4 users registered

is that possible?

Yes that possible... but not tonight.. Got a headace...
If i got time tomorrow i will fix it =)
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

Madman

-- TopRegger Script
-- Made by Madman
-- Requested by ph34r
-- Added stuff for delregging
-- Added so user is remove from table if count == 0

Bot = frmHub:GetHubBotName()
Filename = "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
DelRegCmd = "delreguser" -- The command to delete userss
AllowedToReg = { -- Set to 1 for thoose allowed to reg
	[0] = 1,   -- Masters
	[1] = 1,   -- Operators
	[2] = 0,   -- Vips
	[3] = 0,   -- Regs
}

function Main()
	LoadFromFile(Filename)
end

function DataArrival(curUser, data)
	if strsub(data, 1, 1) == "<" then
	local data = strsub(data,1, -2)
	local s,e,cmd = strfind(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" ..strrep("-",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 = strfind(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"] = date("%Y-%m-%d - %X")
						tTopReg[curUser.sName]["Count"] = 1
						SaveToFile(Filename, tTopReg, "tTopReg")
					else
						tTopReg[curUser.sName]["RegNick"] = Nick
						tTopReg[curUser.sName]["LastReg"] = date("%Y-%m-%d - %X")
						tTopReg[curUser.sName]["Count"] = tTopReg[curUser.sName]["Count"] + 1
						SaveToFile(Filename, tTopReg, "tTopReg")
					end
				end
			end,
			[DelRegCmd] = function(curUser, data)
				if AllowedToReg[curUser.iProfile] == 1 and tTopReg[curUser.sName] then
					local s,e,Nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
					tTopReg[curUser.sName]["RegNick"] = Nick
					tTopReg[curUser.sName]["LastReg"] = date("%Y-%m-%d - %X")
					tTopReg[curUser.sName]["Count"] = tTopReg[curUser.sName]["Count"] - 1
					if tTopReg[curUser.sName]["Count"] <= 0 then
						tTopReg[curUser.sName] = nil
					end
					SaveToFile(Filename, tTopReg, "tTopReg")
				end
			end,
			}
			if tCmds[cmd] then
				return tCmds[cmd](curUser, data)
			end
		end
	end
end

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 format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and 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)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end

This should do the trick..
I made it last night... My headace disapered =)
Was going to post last night... but my isp went down..
Just got back online...

as for QuickThinker....
Still waiting on your replay m8... =)
The stuff you want  shouldnt take long 2 do..
Just need 2 know if you want lua 4 or 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

ph34r

lol we're from the same hub mate. we're requesting the script for the same hub  :D

Madman

#11
QuoteOriginally posted by ph34r
lol we're from the same hub mate. we're requesting the script for the same hub  :D

lol, that would been good to know from the start... lol
i'll make Quicks request as soon i'm done reading all new posts on the board =)

*Edit*

Okey... That should be it...

-- TopRegger Script
-- Made by Madman
-- Requested by ph34r
-- Added stuff for delregging
-- Added so user is remove from table if count == 0
-- Version 2
-- Added 2 reg commands, one 4 reg one for vip
-- Added Moderator and Netfounder profiles

Bot = frmHub:GetHubBotName()
Filename = "TopReggers.txt" -- The text to save things in
RegReg = "regreg" -- The command to used when regging user, no need to write ! or + before the command
RegVip = "regvip" -- The command for regging vips
DelRegCmd = "deluser" -- The command to delete userss
AllowedToReg = { -- Set to 1 for thoose allowed to reg
	[0] = 1,	-- Masters
	[1] = 1,	-- Operators
	[2] = 0,	-- Vips
	[3] = 0,	-- Regs
	[4] = 0,	-- Moderator
	[5] = 0,	-- Netfounder
}

function Main()
	LoadFromFile(Filename)
end

function DataArrival(curUser, data)
	if strsub(data, 1, 1) == "<" then
	local data = strsub(data,1, -2)
	local s,e,cmd = strfind(data, "%b<>%s[%!%+%?%#%+](%S+)")
		if cmd then
			tCmds = {
			["topreg"] = function(curUser, data)
				if curUser.bOperator then
					Msg = "\r\nTop regging ops \r\n\r\nOpertor\tRegged\tCount\tDate & Time\r\n" ..strrep("-",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,
			[RegReg] = function(curUser, data)
				if AllowedToReg[curUser.iProfile] == 1 then
					local s,e,Nick = strfind(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"] = date("%Y-%m-%d - %X")
						tTopReg[curUser.sName]["Count"] = 1
						SaveToFile(Filename, tTopReg, "tTopReg")
					else
						tTopReg[curUser.sName]["RegNick"] = Nick
						tTopReg[curUser.sName]["LastReg"] = date("%Y-%m-%d - %X")
						tTopReg[curUser.sName]["Count"] = tTopReg[curUser.sName]["Count"] + 1
						SaveToFile(Filename, tTopReg, "tTopReg")
					end
				end
			end,
			[RegVip] = function(curUser, data)
				tCmds[RegReg](curUser, data)
			end,
			[DelRegCmd] = function(curUser, data)
				if AllowedToReg[curUser.iProfile] == 1 and tTopReg[curUser.sName] then
					local s,e,Nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
					tTopReg[curUser.sName]["RegNick"] = Nick
					tTopReg[curUser.sName]["LastReg"] = date("%Y-%m-%d - %X")
					tTopReg[curUser.sName]["Count"] = tTopReg[curUser.sName]["Count"] - 1
					if tTopReg[curUser.sName]["Count"] <= 0 then
						tTopReg[curUser.sName] = nil
					end
					SaveToFile(Filename, tTopReg, "tTopReg")
				end
			end,
			}
			if tCmds[cmd] then
				return tCmds[cmd](curUser, data)
			end
		end
	end
end

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 format("[%q]",key) or format("[%d]",key);
		if(type(value) == "table") then
			sTmp = sTmp..Serialize(value, sKey, sTab.."\t");
		else
			local sValue = (type(value) == "string") and 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)
	writeto(file)
	write(Serialize(table, tablename))
	writeto()
end

function LoadFromFile(file)
	if (readfrom(file) ~= nil) then
		readfrom(file)
		dostring(read("*all"))
		readfrom()
	end
end
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

jiten

Have a look at this one.

Cheers

SMF spam blocked by CleanTalk