Rules 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

Rules Bot

Started by Woodster, 16 February, 2004, 18:02:46

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Woodster

Bot = "BOT"


function NewUserConnected(user)
if strfind(data, "rules",1,1) then
   readfrom("rules.txt")
   while 1 do
      line = read()
      if line == nil then break end
      user:SendPM(Bot,line)
      end
   readfrom()
   end
end


If i am correct - then that will send to connected users the "Rules"

Still fairly new to LUA and was wondering from this that i have used - how would i now develop this to not show a bot on the userlist??

Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

well u can simply do

function Main()
frmHub:RegBot(Bot)
end
Resistance is futile!

Woodster

So that would work ??

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user)
if strfind(data, "rules",1,1) then
readfrom("rules.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

QuoteOriginally posted by Woodster
So that would work ??

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user)
if strfind(data, "rules",1,1) then
readfrom("rules.txt")
while 1 do
line = read()
if line == nil then break end
user:SendPM(Bot,line)
end
readfrom()
end
end
no

function NewUserConnected(user) 
if strfind(data, "rules",1,1) then 
readfrom("rules.txt") 
while 1 do 
line = read() 
if line == nil then break end 
user:SendPM(Bot,line) 
end 
readfrom() 
end 
end

this is wrong ;)

if strfind(data, "rules",1,1) then

what data?

function NewUserConnected(user) 
	readfrom("rules.txt") 
	while 1 do 
		line = read() 
		if line == nil then
			break
		end 
		user:SendPM(Bot,line) 
	end 
	readfrom()
end
Resistance is futile!

Woodster

Just tested it and it doesnt send the Rules on connection???

What have i done wrong?
Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

Resistance is futile!

Woodster

I dont know what im doing wrong but still it is not sending the rules to connecting users??
Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

QuoteOriginally posted by Woodster
I dont know what im doing wrong but still it is not sending the rules to connecting users??

hvae you made file named rules.txt?
Resistance is futile!

Woodster

Yup! This is what i using:

function Main()
frmHub:RegBot(Bot)
end

function NewUserConnected(user)
   readfrom("rules.txt")
   while 1 do
      line = read()
      if line == nil then
         break
      end
      user:SendPM(Bot,line)
   end
   readfrom()
end

(its probably that which is incorrect)
Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

my mistake lol

function Main() 
	frmHub:RegBot(Bot) 
end 

function NewUserConnected(user) 
	readfrom("rules.txt") 
	while 1 do 
		line = read() 
		if line == nil then 
			break 
		end 
		user:SendPM(Bot,line) 
	readfrom()
	end 
end

plz when posying code use [ c o d e ] [ / c o d e ] without spaces :)
Resistance is futile!

Woodster

Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

Woodster

LOL

Bet ya getting annoyed now!! lol

still not working......

where do i save the rules.txt?
Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

lol dont forget to add

Bot = "whatever"

and the rules file goes in scripts dir
Resistance is futile!

Woodster

#13
Bot = "Rules"

function Main() 
	frmHub:RegBot(Bot) 
end 

function NewUserConnected(user) 
	readfrom("rules.txt") 
	while 1 do 
		line = read() 
		if line == nil then 
			break 
		end 
		user:SendPM(Bot,line) 
	readfrom()
	end 
end

lol, this lua thing is frustrating when it dont work lol!!

Last attempt otherwise im not gonna bother!

Will that pm Users, Reg's, Op's, Masters etc.. the rules on connection??
Owner of UK...     dc-hubs2     ...UK
Main Address dc-hubs2.ath.cx
Alt Address dc-hubs.no-ip.com
Apart of DC-HUBS NETWORK

pHaTTy

no

add this line

OpConnected = NewUserConnected
Resistance is futile!

pHaTTy

grr got me all confused lol

Bot = "Rules"

function Main() 
	frmHub:RegBot(Bot) 
end 

OpConnected = NewUserConnected
function NewUserConnected(user) 
	readfrom("rules.txt") 
	while 1 do 
		line = read() 
		if line == nil then 
			break 
		end 
		user:SendPM(Bot,line) 
	end 
	readfrom()
end
Resistance is futile!

SMF spam blocked by CleanTalk