!topreg script needed
 

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

!topreg script needed

Started by QuikThinker, 23 August, 2004, 22:48:15

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

QuikThinker

Hey guys,

I'm after a script that will keep a record of who is regging users & how many. Some of my OPs av become lazy fuckers n want a script like Robocop's !tophubbers & !topkickers so that it will display how many people have regged new users. Also maybe an option so it'll display top reggers per week & per month.

Thanx in advance,
Quik.

nErBoS

Hi,

Yes it can be made, can you give us the syntax of your reg command ??

Best regards, nErBoS
--## nErBoS Spot ##--

QuikThinker

It's jus !reguser or !regvip that we use. lol if that's any help watsoeva?

nErBoS

Hi,

OK, but what is the syntax ??

!reguser
!regvip

is it this one ??

Best regards, nErBoS
--## nErBoS Spot ##--


nErBoS

#5
Hi,

The script should be first in the Script List then the script that have the commands, to catch then first. Here you go...

--## Top Regger
--## Requested by QuikThinker
--## Made by nErBoS
--## Commands:
--##	!topreg		-- Show the TOP reggers of the HUB

sBot = "Top-Regger"

arrReg = {}
fReg = "topreg.dat"

--## Configuration ##--

uLaterPtokax = 0	-- Choose 0 if you are using a Ptokax version 0.3.3.0 or higher
			-- Choose 1 if you are using a Ptokax version lower then 0.3.3.0

--## END ##--


function Main()
	frmHub:RegBot(sBot)
	LoadFromFile(fReg)
end

function OnExit()
	SaveToFile(fReg , arrReg , "arrReg")
end

function DataArrival(user,data)
	if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
		data = strsub(data,1,strlen(data)-1)
		s,e,cmd = strfind(data, "%b<>%s+(%S+)")
		if (cmd == "!topreg" and user.bOperator) then
			local sTmp,usr,num = "The TOP reggers of the HUB:\r\n\r\n"
			for usr, num in arrReg do
				sTmp = sTmp.."\tUser: "..usr.." Regged: "..num.."\r\n"
			end
			user:SendPM(sBot, sTmp)
			return 1
		elseif (user.bOperator and (cmd == "!reguser" or cmd == "!regvip")) then
			local s,e,usr,pass = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(%S+)")
			if (usr ~= nil and pass ~= nil) then
				if (arrReg[user.sName] == nil) then
					arrReg[user.sName] = 1
				else
					arrReg[user.sName] = arrReg[user.sName] + 1
				end
				if (uLaterPtokax == 1) then
					OnExit()
				end
			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

Best regards, nErBoS
--## nErBoS Spot ##--

QuikThinker

I tested this Nerbos & all I get when I run the !topreg command is this:
[00:42:20] The TOP reggers of the HUB:



Any ideas?

nErBoS

Hi,

Have you register any one ??? With the right syntax ??Is the script first then your major script in the Script List ??

Best regards, nErBoS
--## nErBoS Spot ##--

QuikThinker

lol yea we regged quite a few & I put it at the very top of the scriptlist. Still nuttin. It did create the .dat file but that was empty.

nErBoS

Hi,

Strange i have tried out and worked for me. Try to make him first in the list please. And i belive that this option "uLaterPtokax = 0" is acourd to yout ptokax version.

Best regards, nErBoS
--## nErBoS Spot ##--

SMF spam blocked by CleanTalk