!lame script :)
 

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

!lame script :)

Started by enema, 22 September, 2004, 18:10:53

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

enema

Hi!!!

Im back with more crazy ideas, to bring some fun into PtokaX :) OK, here it goes: I need a script with who everybody can vote the biggest lamer of the hub like this - !lame nick. It would be cool, if the biggest lamer would be announced once a day by LAME-o-bot. Im just so tired of questions like these - does anybody have this... and that... bla bla...?? Or - why cant i download anything???

skandaluz

Well i see how it could be usefull if u want ppl to feel unwelcomed and scared to ask questions...everyone has to start sum where i know even u were a newb once.... in my hub no question is a stupid question and about does anyone have remark... i know that i dont have the capacity on my drives to store everything  that i have and i'm sure i'm not the only one...so just cause its not shared doesnt mean that sumone doesnt have it :)
---> theonez.no-ip.com <-- MAC - Linux users Welcomed

enema

yeah, I see your point... but you see... my hub is quite private. Everybody knows each other, so thats why I think it would be fun. And my hub is full with punks, so nobody f*ckin care :D Btw, one of my friend has a hub, where lamers show up every day... i mean - they ask the same questions every day and even flood a little... its annoying.

skandaluz

ya i guess it could be usefull for you...another way to go is using a script that only allows registerd users to speak in the main chat and a deflood script for them nasty flooders
---> theonez.no-ip.com <-- MAC - Linux users Welcomed

enema

grr.... I still want that script! I know, it exist... I just dont know, where to get it

nErBoS

Hi,

Here you have...

--## Lamer Bot
--## Requested by enema
--## Made by nErBoS
--## Commands;
--##	!lamer 	- Puts a vote to a nick as lamer
--##	!lamers		- Show the list of the 10 TOP lamers

sBot = "L-Bot"

arrLamer = {}
arrTemp = {}
fLamer = "lamer.dat"

--## Configuration ##--

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

--## END ##--

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

function OnExit()
	SaveToFile(fLamer , arrLamer , "arrLamer")
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 == "!lamer") then
			local s,e,nick = strfind(data, "%b<>%s+%S+%s+(%S+)")
			if (nick == nil) then
				user:SendData(sBot, "Syntax Error, !lamer , you must write a nick.")
			elseif (arrLamer[strlower(nick)] ~= nil) then
				if (arrLamer[strlower(nick)]["VOTERS"][user.sName] ~= nil) then
					user:SendPM(sBot, "You have already voted for "..nick)
				else
					arrLamer[strlower(nick)]["VOTERS"][user.sName] = 1
					arrLamer[strlower(nick)]["VOTED"] = arrLamer[strlower(nick)]["VOTED"]+1
					user:SendPM(sBot, "Your vote has been saved.")
					if (uLaterPtokax == 1) then
						OnExit()
					end
				end
			else
				arrLamer[strlower(nick)] = {}
				arrLamer[strlower(nick)]["VOTERS"] = {}
				arrLamer[strlower(nick)]["VOTERS"][user.sName] = 1
				arrLamer[strlower(nick)]["VOTED"] = 1
				user:SendPM(sBot, "Your vote has been saved.")
				if (uLaterPtokax == 1) then
					OnExit()
				end
			end
			return 1
		elseif (cmd == "!lamers") then
			user:SendPM(sBot, CheckTop())
			return 1
		end
	end
end

function CheckTop()
	local sTmp,count,len,nick,aux = "The TOP 10 lamers of the HUB:\r\n\r\n",0,ArrayLength()
	while count ~= len do
		local maxvote,maxnick = 0,""
		if (count == 10) then
			return sTmp
		else
			for nick, aux in arrLamer do
				if (arrTemp[nick] == nil and arrLamer[nick]["VOTED"] >= maxvote) then
					maxnick = nick
					maxvote = arrLamer[nick]["VOTED"]
				end
			end
			arrTemp[maxnick] = maxvote
			count = count + 1
			sTmp = sTmp..count.."- Nick: "..maxnick.." Voted: "..maxvote.."\r\n"
		end				
	end
	arrTemp = {}
	return sTmp
end

function ArrayLength()
	local count,index,aux = 0
	for index, aux in arrLamer do
		count = count + 1
	end
	return count
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 ##--

enema

awesome job! we already have had some fun with it ;)

enema

oh, btw, nErBoS, I saw your script makin GUI... Its quite awesome, but I was wounderig, if there isnt any newer or advanced version for it?

nErBoS

#8
Hi,

For the moment, no.

Best regards, nErBoS

--## nErBoS Spot ##--

D-J Valhala

hehe cool cript my friend :]
My PsyIsrael Network
==================
--=[PsyIsrael DC Hub]=--
--=[PsyIsrael Website]=--
==================

enema

grr.... I thought I have to make lamer.dat file in scripts folder.... but it doesnt save top 10. What kind of file I have to make and where I should put it, to save Top 10 when hub has a restart or PC has a restart???

nErBoS

Hi,

You don't need to create any file, the script will do the work himself just remenber to configure this right...

--## Configuration ##--

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

--## END ##--

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

enema

hmm... My hub is running on PtokaX DC Hub 0.3.3.0 build 15.25 [debug], so it should be "0", right? If its so, then it doesnt work :( Or.... im a huge dumbass and I cant do anything right....

enema

I putted "1" in place of "0" and it works now :D  .... Grr... but I still dont understand... is my ptokaX vesrion lower or higher than 0.3.3.0 ??? ?(

nErBoS

Hi,

I have tested in the same version and it worked ok. Did the script popup any error ??

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

enema

whaau.... both posted replies in the same time! lol... and btw, script didnt poped any errors, and it works fine now... but im still woundering - is my ptokaX vesrion lower or higher than 0.3.3.0 ???

nErBoS

#16
Hi,

No you had the rigth configuration, that is why it sounds strange. The file is only created or saved when you restart the script, hub or shutdown the HUB. Just try again and restart and you will see that the file will be saved.

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

SMF spam blocked by CleanTalk