Little error maybe :?
 

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

Little error maybe :?

Started by Davey, 18 July, 2007, 12:57:06

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Davey

When i past the code to the script I get an error
this is the code
function ChatArrival(user, data)
  if user.bOperator then
    local data=string.sub(data,1,string.len(data)-1)
    local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
    if cmd =="!aan" then
	SendPmToAll(Botname,"\r\n\tI'm be activated !.")
	if SendMain == "off" then
              SendMain = "on"
			return 1
    elseif cmd =="!uit" then
      SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")
	if SendMain == "on" then
              SendMain = "off"
      StopTimer()
			return 1
		end
	end
	collectgarbage()
end


and this is the hole script maybe some one can help me
------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 15                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
-------------------------------------------------------------------------------------------------

MessaGe = {
"Welcome to "..frmHub:GetHubName()..".",


}

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

function OnTimer()
	if Start==1 then
		MessaGe = MessaGe[math.random(1,table.getn(MessaGe))]
		SendToAll(BotName, " "..MessaGe.."  ")
	end
end

OnError = function(ErrorMsg)
	if ErrorMsg then
		SendPmToOps(Botname, "Hi. I have found a error, Please notify [NL]Davey with the follow message :: Error: "..ErrorMsg)
	end
end

function ChatArrival(user, data)
  if user.bOperator then
    local data=string.sub(data,1,string.len(data)-1)
    local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
    if cmd =="!aan" then
	SendPmToAll(Botname,"\r\n\tI'm be activated !.")
	if SendMain == "off" then
              SendMain = "on"
			return 1
    elseif cmd =="!uit" then
      SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")
	if SendMain == "on" then
              SendMain = "off"
      StopTimer()
			return 1
		end
	end
	collectgarbage()
end

blastbeat

what error do you get in which line?

Davey

sorry forgot to post
this the error
TestBot.lua:59: 'end' expected (to close 'function' at line 40) near '<eof>'

blastbeat

try this:

function ChatArrival(user, data)
	if user.bOperator then
    		local data=string.sub(data,1,string.len(data)-1)
    		local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
    		if cmd =="!aan" then
			SendPmToAll(Botname,"\r\n\tI'm be activated !.")
			if SendMain == "off" then
              				SendMain = "on"
				return 1
    			elseif cmd =="!uit" then
      				SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")
				if SendMain == "on" then
              					SendMain = "off"
      					StopTimer()
					return 1
				end
			end
		end
	end
	collectgarbage()
end

but the code makes no sense i think because the "!uit" if block is inside of the "!aan" if block

Leun

#4
or try this :-)

function ChatArrival(user, data)
	if user.bOperator then
		local data = string.sub(data,1,-2)
		local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
		if cmd =="!aan" then
			SendPmToAll(BotName,"\r\n\tI'm be activated !.")
			if SendMain == "off" then
				SendMain = "on"
				return 1
			end	
		elseif cmd =="!uit" then
			SendPmToAll(BotName,"\r\n\tI'm off now bye bye.")
			if SendMain == "on" then
				SendMain = "off"
				StopTimer()
				return 1
			end
		end
	end	
	collectgarbage("collect")
end


Davey

#6
Hi thnx 4 the reply's

I have test all the 2 functions.
Get no error on it
But if I do  now !aan or !uit then the script doesn't nothing
But it must send with !aan the follow message
SendPmToAll(Botname,"\r\n\tI'm be activated !.")

and with !uit SendPmToAll(Bot,"\r\n\tI'm off now bye bye.")

But I get this
Blasbeast :::

[ :-: ] 13:04:17 [ :-: ] <Davey> !aan
[ :-: ] 13:04:19 [ :-: ] <Davey> !uit
Leun :::

[ :-: ] 13:09:06 [ :-: ] <Davey> !aan
and the command !uit doesn't show

So I think I must add the cmd's to the bot configuration :?
Or have you peepz any other idea :?
Or change the cmd to !boton and !botoff

blastbeat

it is a good idea to add the commands to bot configuration but it is no must.
i think the error is: you use Botname and Bot in SendPmToAll..., not BotName.
try this:

function ChatArrival(user, data)
	if user.bOperator then
		local data = string.sub(data,1,-2)
		local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
		if cmd =="!aan" then
			SendPmToAll(BotName,"\r\n\tI'm be activated !.")
			if SendMain == "off" then
				SendMain = "on"
				return 1
			end	
		elseif cmd =="!uit" then
			SendPmToAll(BotName,"\r\n\tI'm off now bye bye.")
			if SendMain == "on" then
				SendMain = "off"
				StopTimer()
				return 1
			end
		end
	end	
	collectgarbage("collect")
end

Leun


Davey

#9
hahaha
Lolz one litle misstake and the bot doesn't work perfectly lol
But anyway thnx 4 the help peepz ;-)

The bots works now :-)
lolz
get now a new error :-(
TestBot.lua:42: bad argument #1 to 'getn' (table expected, got string)

Error Fixed !
Thnx to blastbeat !


Ok ok, after long time getting no errors, I have get another one :-(

Now I get the follow message :
TestBot.lua:110: 'end' expected (to close 'if' at line 103) near 'else'
And I have try a lot of things, but nothing that helps

Can somebody help me with this error :?

--// FunBot and Helpfully bot made by [NL]Davey
--// blastbeat ::--> thnx 4 your help.. with the function Ontimer !
--// If you found report please notify me with it
--// Added Joke's, Right Click, Login Message, Help Commands !
--// Turning Bot on/off Only avaible for Ops// Other commands avaible for every one !
--//                  EnjoY With It

------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 1                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
LogiN = "on"            -- Send Login Message on/off 
RC_Name = "MesseGe?"    -- The name of your RIght Click 
Owner = "Davey"         -- Owner Name 
-------------------------------------------------------------------------------------------------

MessaGe = {
"\r\n\t\ Welcome to "..frmHub:GetHubName()..".",
"\r\n\t\ Whiiiiii, im so happy today :-D",
"\r\n\t\ Girl Rock Your Boddy",
"\r\n\t\ I think that [NL]Davey a Great scripter is",
"\r\n\t\ If you think im a bot then..... you have it fucKinG wronG !",
"\r\n\t\ WAZZZZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"\r\n\t\ Ownooo, I lose all my money",
"\r\n\t\ Ask A Operator for VIP status or check you right click commands",
"\r\n\t\ Im The BOM MUHAHAHAHAHAHA",
"\r\n\t\ 24 hours in a day ... 24 beers in a case ... coincidence?",
"\r\n\t\ The village called for ya ................... they want their idiot back",
"\r\n\t\ Don't piss me off! I'm running out of places to hide the bodies.",
"\r\n\t\ This hub is running Talk and HelpFullY Bot by [NL]Davey",
"\r\n\t\ The best hub owner is "..Owner.." ",
}


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

function OnTimer()
	if Start==1 then
		local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
		SendToAll(BotName, " "..MessaGe.."  ")
	end
end

OnError = function(msg)
	SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

function ChatArrival(user, data)
                local data = string.sub(data,1,-2)
		local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
		if cmd =="!askvip" then
			SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
                        user:SendData(BotName,"Your request has been send! please be Patient !")
				return 1
                   end
                if cmd =="!showhub" then
               dofile("FriendlyHubs.txt")
		if next(FriendlyTable) then
			local disp = "\r\n\t"..string.rep("- -",20).." FriendlyHubs "..string.rep("- -",20).."\r\n"
			disp = disp.."\t\r\n"
				for v, i in pairs(FriendlyTable) do
					disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
				end
			disp = disp.."\r\n\t"..string.rep("- -",49)..""
			user:SendPM(BotName, disp)
		else
			user:SendData(BotName,"ERROR! There are no friendly hubs added")
	return 1
end
end
          if user.bOperator then
		if cmd =="!aan" then
			SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
			if SendMain == "off" then
				SendMain = "on"
				return 1
			end	
		elseif cmd =="!uit" then
			SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leace this hub for a while !!")
			if SendMain == "on" then
				SendMain = "off"
				StopTimer()
				return 1
			end
                elseif cmd =="!mhelp" then
                        user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !aan   -- The bot go On\r\n\t !uit   -- The bot go Off \r\n\t !mhelp -- Show this page")
				return 1
			end
                elseif cmd =="!addhub" then
                local s,e,cmd,minshare,what,addy,name = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
		if FriendlyTable[name]== nil then
			if minshare then
				if what then
					if addy then
						if name then
							FriendlyTable[name] ={minshare,what,addy}
							saveTableToFile(FriendlyHubs,FriendlyTable,"FriendlyTable")
							SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
						else
				user:SendData(BotName, "Command is ::  !addfriendly <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
		else
			user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
	       return 1
  end

	collectgarbage("collect")
end

function NewUserConnected(user)
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
          if user.bOperator then
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !aan&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !uit&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Help$<%[mynick]> !mhelp&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
	end
end
OpConnected = NewUserConnected

6Marilyn6Manson6

#10
Try now:

--// FunBot and Helpfully bot made by [NL]Davey
--// blastbeat ::--> thnx 4 your help.. with the function Ontimer !
--// If you found report please notify me with it
--// Added Joke's, Right Click, Login Message, Help Commands !
--// Turning Bot on/off Only avaible for Ops// Other commands avaible for every one !
--// EnjoY With It
------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 1                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
LogiN = "on"            -- Send Login Message on/off 
RC_Name = "MesseGe?"    -- The name of your RIght Click 
Owner = "Davey"         -- Owner Name 
-------------------------------------------------------------------------------------------------
MessaGe = {
"\r\n\t\ Welcome to "..frmHub:GetHubName()..".",
"\r\n\t\ Whiiiiii, im so happy today :-D",
"\r\n\t\ Girl Rock Your Boddy",
"\r\n\t\ I think that [NL]Davey a Great scripter is",
"\r\n\t\ If you think im a bot then..... you have it fucKinG wronG !",
"\r\n\t\ WAZZZZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"\r\n\t\ Ownooo, I lose all my money",
"\r\n\t\ Ask A Operator for VIP status or check you right click commands",
"\r\n\t\ Im The BOM MUHAHAHAHAHAHA",
"\r\n\t\ 24 hours in a day ... 24 beers in a case ... coincidence?",
"\r\n\t\ The village called for ya ................... they want their idiot back",
"\r\n\t\ Don't piss me off! I'm running out of places to hide the bodies.",
"\r\n\t\ This hub is running Talk and HelpFullY Bot by [NL]Davey",
"\r\n\t\ The best hub owner is "..Owner.." ",
}

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

function OnTimer()
	if Start==1 then
		local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
		SendToAll(BotName, " "..MessaGe.."  ")
	end
end

function OnError(msg)
	SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

function ChatArrival(user, data)
	local data = string.sub(data,1,-2)
	local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd =="!askvip" then
		SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
		user:SendData(BotName,"Your request has been send! please be Patient !")
		return 1
	end
	if cmd =="!showhub" then
		dofile("FriendlyHubs.txt")
		if next(FriendlyTable) then
		local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
			disp = disp.."\t\r\n"
			for v, i in pairs(FriendlyTable) do
				disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
			end
			disp = disp.."\r\n\t"..string.rep("- -",49)..""
			user:SendPM(BotName, disp)
		else
			user:SendData(BotName,"ERROR! There are no friendly hubs added")
			return 1
		end
	end
	if user.bOperator then
		if cmd =="!aan" then
			SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
			if SendMain == "off" then
				SendMain = "on"
				return 1
			end	
		elseif cmd =="!uit" then
			SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leace this hub for a while !!")
			if SendMain == "on" then
				SendMain = "off"
				StopTimer()
				return 1
			end
			elseif cmd =="!mhelp" then
				user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !aan   -- The bot go On\r\n\t !uit   -- The bot go Off \r\n\t !mhelp -- Show this page")
				return 1
			end
		elseif cmd =="!addhub" then
		local s,e,cmd,minshare,what,addy,name = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
		if FriendlyTable[name]== nil then
			if minshare then
				if what then
					if addy then
						if name then
							FriendlyTable[name] ={minshare,what,addy}
							saveTableToFile(FriendlyHubs,FriendlyTable,"FriendlyTable")
							SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
					else
						user:SendData(BotName, "Command is ::  !addfriendly <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
						end	
					else
					user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
					return 1
					end
				collectgarbage("collect")
				end
			end	
		end
	end
end

function NewUserConnected(user)
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
	if user.bOperator then
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !aan&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !uit&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Help$<%[mynick]> !mhelp&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
	end
end

OpConnected = NewUserConnected
--// 6Marilyn6Manson6

Davey

hi,

I have test the script but the command !addhub doesn't work
I get No errors in the script but command doesn't work
[ :-: ] 18:56:47 [ :-: ] <Davey> !addhub test 10 GB

Anyway thnx 4 your help m8

6Marilyn6Manson6

I can test this script this evening and I fixed it, i post new version this night, c ya

Davey

Oki,

Im still working on it to the !addhub function...

Hope it is fixed soon ..

Thnx

[NL]Daddy-Bear?

Hello it?s me again.
Made some change just need some help with  !addhub
Who can help ?
--// FunBot and Helpfully bot made by [NL]Davey
--// blastbeat ::--> thnx 4 your help.. with the function Ontimer !
--// If you found report please notify me with it
--// Added Joke's, Right Click, Login Message, Help Commands !
--// Turning Bot on/off Only avaible for Ops// Other commands avaible for every one !
--//                  EnjoY With It

------------------------------------Configuration------------------------------------------------
BotName = "MesseGe?"    -- The Name of your bot [ duhh ]
Start = 1               -- Start with script restarting 1 = yes  0 = no
Mins = 11                -- Interval between the message's if Start = 1
SendMain = "on"         -- Send Message to Main on/off
LogiN = "on"            -- Send Login Message on/off 
RC_Name = "MesseGe?"    -- The name of your RIght Click 
Owner = "Davey"         -- Owner Name 
-------------------------------------------------------------------------------------------------

MessaGe = {
"\r\n\t\ Welcome to "..frmHub:GetHubName()..".",
"\r\n\t\ Whiiiiii, im so happy today :-D",
"\r\n\t\ Girl Rock Your Boddy",
"\r\n\t\ I think that [NL]Davey a Great scripter is",
"\r\n\t\ If you think im a bot then..... you have it fucKinG wronG !",
"\r\n\t\ WAZZZZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
"\r\n\t\ Ownooo, I lose all my money",
"\r\n\t\ Ask A Operator for VIP status or check you right click commands",
"\r\n\t\ Im The BOM MUHAHAHAHAHAHA",
"\r\n\t\ 24 hours in a day ... 24 beers in a case ... coincidence?",
"\r\n\t\ The village called for ya ................... they want their idiot back",
"\r\n\t\ Don't piss me off! I'm running out of places to hide the bodies.",
"\r\n\t\ This hub is running Talk and HelpFullY Bot by [NL]Davey",
"\r\n\t\ The best hub owner is "..Owner.." ",
}


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

function OnTimer()
	if Start==1 then
		local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
		SendToAll(BotName, " "..MessaGe.."  ")
	end
end

OnError = function(msg)
	SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

function NewUserConnected(user)
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
          if user.bOperator then
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !aan&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !uit&#124;")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Help$<%[mynick]> !mhelp&#124;")
user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addword %[line:Geef minshare zonder gb etc] %[line:Geef GB MB etc] %[line:Hub naam]&#124;|")
                user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
	end
end
OpConnected = NewUserConnected

function ChatArrival(user, data)
                local data = string.sub(data,1,-2)
		local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
		if cmd =="!askvip" then
			SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
                        user:SendData(BotName,"Your request has been send! please be Patient !")
				return 1
                   end
                if cmd =="!showhub" then
               dofile("FriendlyHubs.txt")
		if next(FriendlyTable) then
			local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
			disp = disp.."\t\r\n"
				for v, i in pairs(FriendlyTable) do
					disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
				end
			disp = disp.."\r\n\t"..string.rep("- -",49)..""
			user:SendPM(BotName, disp)
		else
			user:SendData(BotName,"ERROR! There are no friendly hubs added")
	return 1
end
end
          if user.bOperator then
		if cmd =="!aan" then
			SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
			if SendMain == "off" then
				SendMain = "on"
				return 1
			end	
		elseif cmd =="!uit" then
			SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leace this hub for a while !!")
			if SendMain == "on" then
				SendMain = "off"
				StopTimer()
				return 1
			end
               elseif cmd =="!mhelp" then
                        user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !aan   -- The bot go On\r\n\t !uit   -- The bot go Off \r\n\t !mhelp -- Show this page")
				return 1
--			end
                elseif cmd =="!addhub" then
				SendToAll ("1111111111")
                local s,e,cmd,minshare,what,addy,name = string.find( data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
		if FriendlyTable[name]== nil then
		if minshare then 
				if what then 
					if addy then 
						if name then
							SendToAll ("222222222")
							FriendlyTable[name] ={minshare,what,addy}
							saveTableToFile(FriendlyHubs,FriendlyTable,"FriendlyTable")
							SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
						else
				user:SendData(BotName, "Command is ::  !addfriendly <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
--		if FriendlyTable[name] ~= nil then
--		user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
	       return 1
--					end
					end
				end
		   end
		end
	end
end
	collectgarbage("collect")
	end
end


Respectfully,

[NL]Daddy-Bear?
???????????? Lets enjoy our Hobby ??????????

dchub://daddys-friends-association.no-ip.org:4106

take a peek you are welcome :D

Davey

Hi im back with another problem :P
Somebody can fix it :?

When I add the code :
function NewUserConnected(user)
	--SendToAll(MyInfoString)
       if LogiN=="on"  then

The nothings works anymore .... Only the talking Bot.. Rc =Disabled and the other Commands

Hole Code is
--// FunBot and Helpfully bot made by [NL]Davey]
--// If you found report please notify me with it
--// This bot has the follow things :: Talk Bot, Right Commands, Debugger, LogiN MessaGe
--// Thnx to C??o?y?? & [NL]Daddy-Bear?4 helping with testing script
--//                  EnjoY With It

------------------------------------Configuration------------------------------------------------
BotName = "HelpFully"           -- The Name of your bot [ duhh ]
Start = 1                       -- Start with script restarting 1 = yes  0 = no
Mins = 1                        -- Interval between the message's if Start = 1
SendMain = "on"                 -- Send Message to Main on/off
LogiN = "on"                    -- Send Login Message on/off 
RC_Name = "HelpFully"           -- The name of your RIght Click 
Owner = "Your Name"             -- Owner Name 
Debug = "on"                    -- Put it off if you don't need debug
Vote = ""                       -- Your Vote address
FriendlyHubsFile = "FriendlyHubs.txt"
MessagesFile = "Messages.txt"
-------------------------------------------------------------------------------------------------

FriendlyTable = {}
local f,e = io.open(FriendlyHubsFile, "a+" ) if f then f:write("" ) f:close() end
dofile(FriendlyHubsFile)

MessaGeTable = {}
local f,e = io.open(MessagesFile, "a+" ) if f then f:write("" ) f:close() end
dofile(MessagesFile)

function Main()
	frmHub:RegBot(BotName)
	SendToAll("???????????? This hub is running HelpFully Bot made by [NL]Davey !????????????")
	SetTimer(Mins*60000)
	dofile("Messages.txt")
	if Start == 1 then
		StartTimer()
	end
end

function OnTimer()
	if Start==1 then
		local MessaGe = MessaGe[math.random(1,table.maxn(MessaGe))]
		SendToAll(BotName,MessaGe)
	end
end

function NewUserConnected(user)
	--SendToAll(MyInfoString)
       if LogiN=="on"  then
	user:SendData("???< This Hubs Is RunninG HelpFully Bot v1.0 ?y [NL]Davey >???")
	user:SendData("???< You connected to "..frmHub:GetHubName().." at "..os.date("%H:%M:%S").." o'clock. Welcome!>")
	if user.iProfile == 6 then -- Owner
		SendToAll(BotName, "????????????Owner "..user.sName.." arrived.????????????")
	elseif user.iProfile == 0 then -- Master
		SendToAll(BotName, "????????????Master "..user.sName.." is back in da hub. Wacht Out ! ????????????")
	elseif user.iProfile == 5 then -- Netfounder
		SendToAll(BotName, "????????????Netfounder "..user.sName.." arrived with his ladies. Welcome Back ????????????")
	elseif user.iProfile == 1 then -- Operator
		SendToAll(BotName, "????????????Operator "..user.sName.." arrived. Check your shared files before he/she do it.???????????? ")
	elseif user.iProfile == 4 then -- Moderator
		SendToAll(BotName, "????????????Moderator "..user.sName.." arrived in his car. Welcome back???????????? ")
	elseif user.iProfile == 2 then -- VIP
		SendToAll(BotName, "????????????VIP "..user.sName.." is coming back for sharing new files!???????????? ")
	elseif user.iProfile == 3 then -- Reg
		SendToAll(BotName, "????????????Regged Person "..user.sName.." arrived.????????????")
	end
	user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
	user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
	user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
	if user.bOperator then
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger On$<%[mynick]> !debugon&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger Off$<%[mynick]> !debugoff&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages On$<%[mynick]> !LogiNOn&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages Off$<%[mynick]> !LogiNOff&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !talkon&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !talkoff&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show me the Bot Commands$<%[mynick]> !mhelp&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
	end
end

OpConnected = NewUserConnected

OnError = function(msg)
	SendPmToOps(BotName,"Hi. I have found an error. Please notify [NL]Davey with the follow message : "..msg)
end

ChatArrival = function(user,data)
	local data = string.sub(data,1,-2)
	local _,_,cmd = string.find(data,"%b<>%s+(%S+)")
	if cmd =="!askvip" then
		if Debug == "on" then
			SendToAll("debugger",data)
		end
		SendPmToOps(BotName,"\r\n\t "..user.sName.." want become a vip in this hub .")
		user:SendData(BotName,"Your request has been send! please be Patient !")
		return 1
	end
	if cmd =="!showhub" then
		if next(FriendlyTable) then
			local disp = "\r\n\t"..string.rep("- -",20).." Friendly Hubs "..string.rep("- -",20).."\r\n"
			disp = disp.."\t\r\n"
			for v, I in pairs(FriendlyTable) do
				disp = disp.."\t\tName:  "..v.."\tAddress: "..FriendlyTable[v][3].."\tMinshare: "..FriendlyTable[v][1]..""..FriendlyTable[v][2].."\r\n"
			end
			disp = disp.."\r\n\t"..string.rep("- -",49)..""
			user:SendPM(BotName, disp)
		else
			user:SendData(BotName,"ERROR! There are no friendly hubs added")
		end
		return 1
	end
	if user.bOperator then
		if cmd =="!talkon" then
			if Debug == "on" then
				SendToAll("debugger",data)
			end
			SendToAll(BotName,"\r\n\t "..user.sName.." is calling the bot to talk again !!")
			if SendMain == "off" then
				SendMain = "on"
			end
			return 1
		end
		if cmd =="!talkoff" then
			if Debug == "on" then
				SendToAll("debugger",data)
			end
			SendToAll(BotName,"\r\n\t "..user.sName.." Says to the bot: Leave this hub for a while !!")
			if SendMain == "on" then
				SendMain = "off"
				StopTimer()
			end
			return 1
		end
		if cmd =="!mhelp" then
			if Debug == "on" then
				SendToAll("debugger",data)
			end
			user:SendPM(BotName,"\r\n\t This is the Help Menu for Talker.\r\n\t !talkon   -- The bot go On\r\n\t !talkoff   -- The bot go Off \r\n\t !mhelp -- Show this page \r\n\t !help  -- All avaible commands for your pofile ")
			return 1
		end
		if cmd =="!addhub" then
			if Debug == "on" then
				SendToAll("debugger",data)
			end
			local _,_,cmd,minshare,what,addy,name = string.find(data,"%b<>%s+(%S+)%s+(%S+)%s+(%S+)%s+(%S+)%s+(.*)")
			if FriendlyTable[name]== nil then
				if minshare and what and addy and name then
					FriendlyTable[name] ={minshare,what,addy}
					saveTableToFile(FriendlyHubsFile,FriendlyTable,"FriendlyTable")
					SendToOps(BotName,""..user.sName.." has added : "..name.." to the Friendly Hub List !!")
				else
					user:SendData(BotName, "Command is ::  !addhub <minshare> <b/kb/mb/gb/tb> <address> <hub name>!!!")
				end
			else
				user:SendData(BotName, "Sorry, but the hub : "..name.." is allready in my Friendly List !!")
			end
			return 1
		end
	else
		user:SendData(BotName,"This was Operator command... you are not allowed to use it!")
		return 1
	end
	if cmd =="!debugoff" then
				if Debug == "on" then
				Debug = "off"
				SendToAll(BotName, " "..user.sName.." has disabled the debugger ! ")
				end
			return 1
		end
	if cmd =="!debugon" then
	            if Debug == "off" then
				Debug = "on"
				SendToAll(BotName, " "..user.sName.." has enabled the debugger !")
				end
			return 1
		end
	if cmd =="!LogiNOn" then
	            if LogiN == "off" then
				LogiN = "on"
				SendToAll(BotName, " "..user.sName.." has enabled the LogiN messages!")
				end
			return 1
	    end
	if cmd =="!LogiNOff" then
	            if LogiN == "on" then
				LogiN = "off"
				SendToAll(BotName, " "..user.sName.." has disabled the LogiN messages !")
				end
			return 1
		end
	collectgarbage("collect")
end

Serialize = function(tTable,sTableName,hFile,sTab)
	sTab = sTab or ""
	hFile:write(sTab..sTableName.." = {\n")
	for key,value in pairs(tTable) do
		if (type(value) ~= "function") then
			local sKey = (type(key) == "string") and string.format("[%q]",key) or string.format("[%d]",key)
			if(type(value) == "table") then
				Serialize(value,sKey,hFile,sTab.."\t")
			else
				local sValue = (type(value) == "string") and string.format("%q",value) or tostring(value)
				hFile:write(sTab.."\t"..sKey.." = "..sValue)
			end
			hFile:write(",\n")
		end
	end
	hFile:write(sTab.."}")
end

saveTableToFile = function(file, table, tablename)
	local handle = io.open(file,"w")
	Serialize(table,tablename,handle)
   	handle:close()
	io.flush()
end
end



can somebody help ;x ;-)

blastbeat

#16
i guess an "end" is missing:

function NewUserConnected(user)
	--SendToAll(MyInfoString)
       if LogiN=="on"  then
             .
             .
             .
             .
       end
end

Davey

End is here

user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\?Login And Register MessaGe By [NL]Davey?$<%[mynick]>&#124;")
	end
end


But it doesn't works :-(

blastbeat

#18
no it isnt

function NewUserConnected(user)
       if LogiN=="on"  then

	if user.iProfile == 6 then -- Owner

	end

	if user.bOperator then

	end
end


try this:

function NewUserConnected(user)
	--SendToAll(MyInfoString)
       if LogiN=="on"  then
	user:SendData("•••< This Hubs Is RunninG HelpFully Bot v1.0 ?y [NL]Davey >•••")
	user:SendData("•••< You connected to "..frmHub:GetHubName().." at "..os.date("%H:%M:%S").." o'clock. Welcome!>")
	if user.iProfile == 6 then -- Owner
		SendToAll(BotName, "?˜”??•?˜”??•Owner "..user.sName.." arrived.•??”˜?•??”˜?")
	elseif user.iProfile == 0 then -- Master
		SendToAll(BotName, "?˜”??•?˜”??•Master "..user.sName.." is back in da hub. Wacht Out ! •??”˜?•??”˜?")
	elseif user.iProfile == 5 then -- Netfounder
		SendToAll(BotName, "?˜”??•?˜”??•Netfounder "..user.sName.." arrived with his ladies. Welcome Back •??”˜?•??”˜?")
	elseif user.iProfile == 1 then -- Operator
		SendToAll(BotName, "?˜”??•?˜”??•Operator "..user.sName.." arrived. Check your shared files before he/she do it.•??”˜?•??”˜? ")
	elseif user.iProfile == 4 then -- Moderator
		SendToAll(BotName, "?˜”??•?˜”??•Moderator "..user.sName.." arrived in his car. Welcome back•??”˜?•??”˜? ")
	elseif user.iProfile == 2 then -- VIP
		SendToAll(BotName, "?˜”??•?˜”??•VIP "..user.sName.." is coming back for sharing new files!•??”˜?•??”˜? ")
	elseif user.iProfile == 3 then -- Reg
		SendToAll(BotName, "?˜”??•?˜”??•Regged Person "..user.sName.." arrived.•??”˜?•??”˜?")
	end
	user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Avaible Commands for me$<%[mynick]> !help&#124;")
	user:SendData("$UserCommand 1 3 "..RC_Name.."\\Ask for Vip Satus$<%[mynick]> !askvip&#124;")
	user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show Friendly Hubs$<%[mynick]> !showhub&#124;")
	if user.bOperator then
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger On$<%[mynick]> !debugon&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Debugger Off$<%[mynick]> !debugoff&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages On$<%[mynick]> !LogiNOn&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\LogiN Messages Off$<%[mynick]> !LogiNOff&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker On$<%[mynick]> !talkon&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Talker Off$<%[mynick]> !talkoff&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Show me the Bot Commands$<%[mynick]> !mhelp&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\Add a Friendly Hub$<%[mynick]> !addhub %[line:Minshare NO Ammount!] %[line:b/kb/mb/gb/tb] %[line:Adress] %[line:Hubname]&#124;")
		user:SendData("$UserCommand 1 3 "..RC_Name.."\\•Login And Register MessaGe By [NL]Davey•$<%[mynick]>&#124;")
	end
      end
end

Davey

#19
Oki i will try it :-)

-------------------------------------------------------------------------------------
Ok I have test it and now its works perfect.
Thnx 4 your help blastbeat ;-)
;D

6Marilyn6Manson6

Quote from: blastbeat on 21 July, 2007, 14:22:38
i guess an "end" is missing:

function NewUserConnected(user)
	--SendToAll(MyInfoString)
       if LogiN=="on"  then
             .
             .
             .
             .
       end


Quote, you missing one "end" in your function

Davey

#21
Thnx 4 the replys...
The bot is now finished ;-)

Thnx 4 all helping with it :-)
Hi

I have got an error with random messages...
I have never before get this error,

It is fixed

Ok I thought it was fixed, but now doesn't the script check badnicknames
Can somebody help me with it ?

this it the table
FriendlyTable = {}
MessaGeTable = {}
BadnicknameTable = {}

tables = {
	FriendlyHubsFile,
	MessagesFile,
	BadnicknameFile
}

for _,file in pairs(tables) do
	local f,e = io.open(file, "a+" ) if f then f:write("" ) f:close() end
	dofile(file)
end


and this is the code of myinfo
MyINFOArrival = function(user,data)
	for _,bad in pairs(tables) do
		local bad,nick = bad:lower(),user.sName:lower()
		if nick:find(bad) then
			user:SendData(frmHub:GetHubBotName(),"bye jerk")
			SendPmToOps(BotName," "..user.sName.." with ip "..user.sIP.." is been disconnected because: He use a Bad Nick Name!")
			user:Disconnect()
		end
	end
end

Leun

#22
try this (not tested)

-- load table from file
dofile(BadnicknameFile)


or

tables = {
	FriendlyHubsFile,
	MessagesFile,
	BadnicknameFile
}

for _,file in pairs(tables) do
	local f,e = io.open(file, "a+" ) if f then f:write("" ) f:close() end
	dofile(file)
end


and

MyINFOArrival = function(user,data)
	for _,bad in pairs(BadnicknameTable) do
		local bad,nick = bad:lower(),user.sName:lower()
		if nick:find(bad) then
			user:SendData(frmHub:GetHubBotName(),"bye jerk")
			SendPmToOps(BotName," "..user.sName.." with ip "..user.sIP.." is been disconnected because: He use a Bad Nick Name!")
			user:Disconnect()
		end
	end
end

Davey

#23
Hey,

I have test it but it doesn't work.
I get No error message but the bot doesn't disconnect the user who used a badnickname

--------------------------------------------------------------------------------------

It's fixed now :-)
Hi,

When I add the function check bad words, the scripts give me this error messages ::->
HelpFullyv1.2.lua:195: bad argument #1 to 'gmatch' (string expected, got nil)
Can Somebody help me ??

Problem Solved :-)

Madman

Code: lua
local s,e,msg = string.find(string.lower(data), "^%b<>(.+)")

Change 194 to that
We suffer in silence, we lurk in the shadows, we kill in the night
Site currently down, ETA of returning online is 2099 ;p

SMF spam blocked by CleanTalk