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???
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 :)
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.
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
grr.... I still want that script! I know, it exist... I just dont know, where to get it
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
awesome job! we already have had some fun with it ;)
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?
Hi,
For the moment, no.
Best regards, nErBoS
hehe cool cript my friend :]
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???
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
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....
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 ??? ?(
Hi,
I have tested in the same version and it worked ok. Did the script popup any error ??
Best regards, nErBoS
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 ???
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