Passive users blocking, Joke bot
 

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

Passive users blocking, Joke bot

Started by JaPaja, 30 July, 2006, 08:43:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JaPaja

Hi,

i'm beginner in lua scripts and i need help. I can't fid anywhere 2 scripts i want to my hub. Can somebody help me?

1 script

I need to separate passive and active users. It should check if user is passive or active. If active, he will come in, if passiwe, he will not be able to connect to hub and he will see message from my bot.

2 script

I want to my hub Joke bot. He should automaticky after chosen time(for example 20 minutes)  load random joke form textfile jokes.txt where 1 joke is one 1 line.

Thanks for help

6Marilyn6Manson6

#1
--// Disconnect Passive User 0.1 made by 6Marilyn6Manson6 30/07/2006
------------------------------------------------------
tSetBotName = "[ITA]aCTiVe"									-- frmHub:GetHubBotName(),
msg1 = "This Hub Accept Only User In Active Mode, Sorry"	-- MSG Here
------------------------------------------------------
function Main()
	if tSetBotName ~= frmHub:GetHubBotName() then
		frmHub:RegBot(tSetBotName)
	end
end
------------------------------------------------------
BlockProfiles = {	-- What profile you want blocked 1/yes 0/no	
[0] = 1,			-- Master
[1] = 1,			-- Operator
[2] = 1,			-- VIP
[3] = 1,			-- Registered
[4] = 1,			-- Moderator
[5] = 1,			-- Netfounder
[-1] = 0,			-- Unregistered
}
------------------------------------------------------
tImmune = {
["6Marilyn6Manson6"] = 1,
["[ITA]6Marilyn6Manson6"] = 1,
}
------------------------------------------------------
NewUserConnected = function(user, data)
	if not user.bActive then
		if BlockProfiles[user.iProfile] ~= 1 then
			if not Immune[user.sName] then
				user:SendData(tSetBotName,msg1)
				user:Disconnect()
				return 1
			end
		end
	end
end
------------------------------------------------------
--// 6Marilyn6Manson6



For second request search JokeBot script in forum

JaPaja

Thank you very much for active/passive bot.

But second one, i'm still searcging for jokebot, but I can not find anyone. Ther is alredy 5 reguests for jokebot loading jokes from external txt file, but no request.

6Marilyn6Manson6

--JokeBot .lua by Cloud
--One liner content by Mutor The Ugly
--Added timer function and on/off commands

BotName = "[WiseGuy]"
-- Start with script 1=yes/0=no
Start = 1
-- Interval between jokes [if Start == "1"]
Mins = 15
-- Send reply back to user in PM? "on"/"off"
SendPM = "off"
-- Send reply to all in Main? "on"/"off"
SendMain = "on"
-- Crack a joke command [use lower case]
Command1 = "+wise"
-- Start jokes on timer command [use lower case]
Command2 = "+crackwise"
-- Stop jokes on timer command [use lower case]
Command3 = "+shaddap"

jokes = {
"Help I've fallen and I...   ...hey nice carpet.",
"24 hours in a day ... 24 beers in a case ... coincidence?",
"Multitasking : Screwing up several things at once.",
"The reason talk is cheap is that supply exceeds demand.",
"Support bacteria - they're the only culture some people have.",
"BE ALERT! ...The world needs more lerts.",
"Shin: a device for finding furniture in the dark",
"Nothing is fool-proof to a sufficiently talented fool.",
"If ignorance is bliss, you must be orgasmic.",
"Stealth means never having to say you're sorry.",
"Back off!! You're standing in my aura.",
"And your cry-baby, whiny-assed opinion would be.....?",
"Next time you wave, use all your fingers.",
"I'm not your type. I'm not inflatable.",
"Reality is a crutch for people who can't handle drugs.",
"They call it 'PMS' because 'Mad Cow Disease' was already taken.",
"You're just jealous because the voices are talking to me.",
"The village called for ya ................... they want their idiot back.",
"Don't piss me off! I'm running out of places to hide the bodies.",
"Not all people are annoying. Some are dead.",
"Chaos, panic and disorder . . . my work here is done.",
"I haven't lost my mind, It's backed up on disk somewhere.",
"Take my advice; I don't use it anyway.",
"Okay, okay! I take it back. Unfuck you!!!",
"How many times do I have to flush before you go away?",
"Despite the high cost of living, it remains popular.",
"A hard-on doesn't count as personal growth.",
"To all you virgins, thanks for nothing.",
"I like kids, but I don't think I could eat a whole one.",
"Who Lit The Fuse On Your Tampon?",
"Rehab Is for Quitters.",
"Cover me, I'm changing lanes.",
"A man can be happy with any woman as long as he doesn't love her.",
"Don't be sexist - Broads hate that.",
"So you're a feminist. Isn't that cute.",
"Love means never having to say, `Does that twenty include spanking?`",
"Incontinence Hotline... Can you hold, please?",
"A penny saved is a government oversight.",
"500,000 sperm and you were the fastest?",
"Press here to test. ..'click'..  Release to detonate.",
"I do whatever my Rice Krispies tell me to.",
"If you try to fail, and succeed, which have you done?",
"Madness takes its toll. Please have exact change.",
"Depression is merely anger without enthusiasm.",
"Nice perfume. Must you marinate in it?",
"What hair color do they put on the driver's licenses of bald men?",
"Bad spellers of the world untie!",
"I'm trying to imagine you with a personality.",
"Errors have been made. Others will be blamed.",
"Artificial intelligence is no match for natural stupidity.",
"What's another word for thesaurus?",
"Red meat is not bad for you Fuzzy green meat is bad for you.",
"KENTUCKY: Five million people, Fifteen last names.",
"I didn't say it was your fault. I said I was going to blame you.",
"Never get into fights with ugly people, they have nothing to lose.",
"Not all men are fools...some are bachelors.",
"Impotence: Nature's Way Of Saying, 'No Hard Feelings'.",
"Smile, everyone loves a moron.",
"Beauty is in the eye of the beer holder....",
"I just want revenge. Is that so wrong?",
"Save the whales: collect the whole set.",
"Vegetarian: Native American definiton for 'lousy hunter'.",
"Consciousness: that annoying time between naps.",
"Beauty is only skin deep; ugly goes clear to the bone.",
"Procrastinate Now !",
"Jack Kevorkian for White House physician.",
"All those who believe in psychokinesis raise my hand.",
"EARTH FIRST! We'll strip-mine the other planets later.",
"Everyone seems normal until you get to know them.",
"Lottery: A tax on people who are bad at ",
"I used to Be Schizophrenic, but WE'RE ok now",
"Friends help you move. Real friends help you move the bodies.",
"Don't take life seriously, you won't get out alive",
"I used to Be Schizophrenic, but WE'RE ok now",
"If quizzes are quizzical, what are tests?",
"Necrophilia: That uncontrollable urge to crack open a cold one.",
"Bigamy: one wife too many. Monogamy: same thing.",
"Constipated People Don't Give A crap.",
"Practice Safe Sex, Go Screw Yourself.",
"If You Drink, Don't Park. Accidents Cause People.",
"If Sex Is A Pain In The butt, Then You're Doing It Wrong...",
"If you have trouble getting your children's attention, just sit down and look comfortable.",
"Don't be afraid of the dark, be afraid of what it hides...",
"Why isn't phonetic spelled the way it sounds?",
"I just got lost in thought. It was unfamiliar territory.",
"Lottery: A tax on people who are bad at ",
"Campers: Natures way of feeding mosquitoes.",
"All generalizations are False.",
"A closed mouth gathers no foot.",
"Boycott shampoo! Demand the REAL poo!",
"Get a new car for your spouse...................... it'll be a great trade!",
"Jesus loves you..........but everyone else thinks you're an asshole.",
"Very funny Scotty, now beam down my clothes.",
"Suicide Hotline...please hold.",
"Ah, yes, divorce, The Latin word meaning to rip out a man's genitals through his wallet.",
"And on the eighth day God said, 'O.K. Murphy. You take over'.",
"Hangover: The wrath of grapes.",
"Hey! Who took the cork off my lunch?!",
"I haven't spoken to my wife for 18 months - I don't like to interrupt her.",
"Penalty for bigamy: Two mothers-in-law.",
"When man discovered milk came from cows, what did he THINK he was doing?",
"102 A bachelor is a selfish, undeserving guy who has cheated some poor woman out of a divorce",
"Confucius say, 'He who makes love in grass, gets piece on earth.'",
"Life is sexually transmitted.",
"There are two kinds of pedestrians... the quick and the dead.",
"Television is chewing gum for the eyes.",
"The best way to save face is to keep the lower half closed.",
"I still miss my ex-wife, but my aim is getting better!",
"If i throw a stick, will you leave?",
"Love is grand. Divorce is one hundred grand.",
"Drugs may lead to nowhere, but at least it's the scenic route.",
"The beatings will continue until morale improves!",
"Keyboard Not Found! Press ENTER to continue.",
"I don't have an attitude problem. You have a perception problem.",
"All things being equal, fat people use more soap.",
"One tequila, two tequila, three tequila, floor.",
"God gave men a penis and a brain, but only enough blood to run one at a time.",
"Better to be occasionally cheated than perpetually suspicious.",
"Christ died for our sins, so let's not disappoint him.",
"You're the reason my dog is pregnant, aren't you?!",
"Reality is a hallucination brought on by lack of alcohol.",
"Some days you're the dog, some days you're the hydrant.",
"I don't suffer from insanity, I savor every moment.",
"Sometimes I wake up grumpy, other times I let her sleep.",
"The law is a rule to the fool, but a guide to the wise.",
"Do NOT start with me you will NOT win.",
"Arrrrgg ............All stressed out with no-one to choke.",
"Next mood swing......six minutes",
"I want it all, and I want it delivered!",
"I'm naturally blonde - please speak slowly",
"Don't be fooled, Im cleverly disguised as a responsible adult.",
"Illiterate? Write For Help..............",
"Fight Crime: Shoot Back! Yo, Ax Me About Ebonics.",
"Heart Attacks: God's Revenge For Eating His Animal Friends.",
"WANTED: Meaningful overnight relationship.",
"I need someone really bad......................Are you really bad?",
"If we quit voting , will all the politicians just go away?",
"I used up all my sick days, so I'm calling in dead.",
"Help!......................The 'paranoids' are after me!",
"What has four legs and an arm? .........A happy pit bull.",
"Windows: Just another pane in the glass.",
"Fat chicks are like mopeds, they are alot of fun until your friends see you with them.",

}


function Main()
	frmHub:RegBot(BotName)
	SetTimer(Mins*60000)
	if Start == 1 then
		StartTimer()
		OnTimer()
	end
end

function OnTimer()
	if Start==1 then
		Joke = jokes[math.random(1,table.getn(jokes))]
		SendToAll(BotName, "- "..Joke.."  >:-D")
	end
end

function ChatArrival(user, data)
	local s,e,cmd = string.find(data,"%b<>%s(%p%w+)")
	if cmd then
		cmd = string.lower(cmd)
		if cmd == Command1 then
			WiseCrack(user)
		elseif cmd == Command2 then
			Start=1
			StartTimer()
			WiseCrack(user)
		elseif cmd == Command3 then
			Start=0
			StopTimer()
		end
		return 1
	end
end

function WiseCrack(user)
	Joke = jokes[math.random(1,table.getn(jokes))]
	if SendPM == "on" then
		user:SendPM(BotName,"<"..user.sName.."> "..Joke.."  >:-D")
	end
	if SendMain == "on" then
		SendToAll(BotName,"<"..user.sName.."> "..Joke.."  >:-D")
	end
	collectgarbage()
end


I have find this script but load jokes from script and not external txt, and I can't touch script made by Mutor :p, called him and made your request and his I thinks made it :)

JaPaja

thanks for your help. i started modifiing jokes in jokebot, becuase my language is czech.

and i have next question for you.

do you know any basic script for this:

in mainchat is type +rules and bot will type rules of hub
i type +info and bot will type info about hub
i type +server and bot will type info about server
i type +op and bot will type names of operators

do you have somenthig like this? this is last thing i need

thanks

6Marilyn6Manson6

#5
Use this and modify txt with your txt :)

JaPaja

thanks. i save it to scripts and made directory helping including textfile news.txt

so iin mainchat i write +news and nothing happend. where is problem?

6Marilyn6Manson6

Quote from: JaPaja on 30 July, 2006, 11:27:56
thanks. i save it to scripts and made directory helping including textfile news.txt

so iin mainchat i write +news and nothing happend. where is problem?

What file txt you want load with this script? Write all txt and I modded script for your txt

JaPaja

i want type +rules and view text in file rules.txt that will be stored in directory PtokaX/script/txt/rules.txt

so:
+rules       rules.txt
+info        info.txt
+server    server.txt
+reg        reg.txt
+op         op.txt
+master   master.txt
+vip         vip.txt

6Marilyn6Manson6

-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
-- Command bot
-- Just sends the text in the text files in pm to the user who asked for it
-- Made by Donald_Duck
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------


sConf = {
	sBot = frmHub:GetHubBotName(),
	sFile1 = "rules.txt",
	sFile2 = "info.txt",
	sFile3 = "server.txt",
	sFile4 = "reg.txt",
	sFile5 = "op.txt",
	sFile6 = "master.txt",
	sFile7 = "vip.txt",
	sFolder = "txt"			-- folder where the file is stored
}

sMenu = "..::TEXT FILES::.."

function Main()
	frmHub:RegBot(sConf.sBot)
end

function ChatArrival(user,data)
	local data = string.sub(data,1,-2)
	local s,e,cmd = string.find (data, "%b<>%s+[%!%?%+%#](%S+)" )
	if cmd then
		local tCmds = 	{
			["rules"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile1))
					end,

			["info"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile2))
					end,
			
			["server"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile3))
					end,

			["reg"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile4))
					end,

			["op"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile5))
					end,
			
			["master"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile6))
					end,

			["vip"] = 	function(user,data)
						user:SendPM(sConf.sBot,ReadFile(sConf.sFile7))
					end,
		}
		if tCmds[cmd] then 
			return tCmds[cmd](user,data), 1
		end
	end
end

function NewUserConnected(user)
	user:SendData("$UserCommand 0 3 |")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Rules Of Hub$<%[mynick]> +rules&#124;|")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Info Of Hub$<%[mynick]> +info&#124;|")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Info Of Server$<%[mynick]> +server&#124;|")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Names Of All Registered Users Of Hub$<%[mynick]> +reg&#124;|")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Names Of All Operators Of Hub$<%[mynick]> +op&#124;|")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Names Of All Masters Of Hub$<%[mynick]> +master&#124;|")
	user:SendData("$UserCommand 1 3 "..sMenu.."\\Names Of All Vips Of Hub$<%[mynick]> +vip&#124;|")
end

function ReadFile(file)
	local fFile = io.open(sConf.sFolder.."/"..file)
	if fFile then
		local message = fFile:read("*all");
		fFile:close();
		return message;
	else
		return file.." not found!"
	end
end

OpConnected=NewUserConnected


Done :)

JaPaja

i don't know where is still problem. it still do not works. should it be by latest ptokax version i mean 0.3.5.1 with lastest lua ?

JaPaja

or should you modifi it, that text will be included in script?

rules = {
rulesrulesrulesrules
rulesrulesrulesrules
rulesrulesrulesrules
}

master = {
mastermastremaster
mastermastermaster
mastermastermaster
}

etc.

6Marilyn6Manson6

This script work with Lua5.0.2 and Lua 5.1.x. In script folder made dir with name "txt" and put your 7 txt, and still work

6Marilyn6Manson6

Quote from: JaPaja on 30 July, 2006, 12:14:34
or should you modifi it, that text will be included in script?

rules = {
rulesrulesrulesrules
rulesrulesrulesrules
rulesrulesrulesrules
}

master = {
mastermastremaster
mastermastermaster
mastermastermaster
}

etc.

This script open txt file and load it, not is necessary made table is txt file, you write and script load file :)

6Marilyn6Manson6

#14
I have tested it with PtokaX 0.3.5.1 Lua 5.1.1 and all work, commands and RightClick. In script dir I have made new sub-dir with name txt and I have put in this dir, my 7 txt file and script load it. See my 3 jpg :)

JaPaja

yes, i see. i have it same. but it still do not works. can you write new script?

i mean:

bot = "informator"

command1 = "+rules"
command2 = "+info"
...


rules = {
rules1
rules2
rules3
}

info = {
info1
info2
info3
}

...


if command1 then type area rules
if command2 then type area info
...

6Marilyn6Manson6

Quote from: JaPaja on 30 July, 2006, 12:43:40
yes, i see. i have it same. but it still do not works. can you write new script?

i mean:

bot = "informator"

command1 = "+rules"
command2 = "+info"
...


rules = {
rules1
rules2
rules3
}

info = {
info1
info2
info3
}

...


if command1 then type area rules
if command2 then type area info
...


I can't wirte new script because this script work and i have tested it. Go in PtokaX folder, after enter in script folder and in this dir made new dir called txt. Enter in txt folder and put 7 txt, called: rules.txt , info.txt , server.txt , reg.txt , op.txt , master.txt , vip.txt. In different txt write what you want, do all with closed hub, and after start hub. Now if you use command +rules +info +server +reg +op +master +vip, different command load different txt and open it in private window, C ya

6Marilyn6Manson6

Extract this rar file in your SCRIPTS folder ;)

JaPaja

i found the problem. it was caused by another bot. it was joke bot i have modified. can you look on this joke bot?

6Marilyn6Manson6


bastya_elvtars

Locking out passive users? Congrats.
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk