3 New scripts required.
 

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

3 New scripts required.

Started by SteffJay, 12 September, 2004, 18:52:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

SteffJay

:P Hello all. I am in need of three scripts, i have looked over the entire site but none will fulfill my needs unless i use a multi-bot, which i do not want to use......  Firstly, i need a working "welcome" script that can be adjusted for Masters, OP's & VIP's. in and out. Secondly, i need a working copy of the joining IP address, slots open, shared amount and in other hubs and lastly, a date time bot that will show D/M/YY (UK style). Too much to ask for ?, i don't think so with all you Einstiens here...  lol.  TIA !!
:))

L8rz

SteffJay

nErBoS

Hi,

First Script...

You want a welcome bot with several possible messeges to Master, OP or VIPs, choose by random, right ???

Second Script...

Didn't understood, you want a offlien userinfo or a hub stat ???

Last Script...

Here you go...

--## Simple Time Bot
--## Requested by SteffJay 
--## Made by nErBoS
--## Commands:
--##	!time - Gives the current time

sBot = "Time-Bot"

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 == "!time") then
			user:SendData(sBot, GetTime())
		end
	end
end

function GetTime()
	s = date("%S")
	h = date("%H")
	m = date("%M")
	d = date("%d")
	mm = date("%m")
	y = date("%y")
	Date = "Date: "..d.."/"..mm.."/20"..y.." Hour "..h..":"..m..":"..s
	return Date
end

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

SteffJay

Hello nErBoS. Thank you for the time bot. Is there a way of making the time bot auto display in main chat with an adjustable time sequence?, say every half an hour ?. The "Welcome" bot needs not  to be random. I would like to make custom log in and log out messages for OP's, VIP's and Masters. The second script is for everyone  joining the hub with hub stats, ie: How much tey are sharing, Mb, Gb and Tb. Their IP address, How many slots open, connection type (cable, 56k, etc), and type of client ie: dc++ v0.401 etc. Hope this helps. Thanks again.  ;)
:))

L8rz

SteffJay

nErBoS

Hi,

Just another question, the welcome BOT will have a message per user or a message to all Master, one to all OPs and one to all VIP or REG ???

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

SteffJay

The Welcome message can include Reg as well but not necessary, mainly required for Master, OP's and VIP's.
:))

L8rz

SteffJay

nErBoS

Hi,

You didn't have respond to my question, i want to know if you want to have a message per user or a message per profile ???

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

SteffJay

A message per user please nErBoS !!!
:))

L8rz

SteffJay

nErBoS

Hi,

OK i have to go know because i have a exam later at night i will give one script that does the 3 scripts.

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

SteffJay

Ok nErBoS, that's great. Good luck with your exam but will not be a problem for you i think....  !!!   :P
:))

L8rz

SteffJay

nErBoS

#9
Hi,

Well the exam... better not even talk about  ;( .
Here are the 3 scripts...

--## Multi BOT Adds
--## Requested by SteffJay 
--## Time showed from 30 minutes to 30 minutes
--## Made by nErBoS
--## Commands:
--##	!time - Gives the current time

sBot = "M-Bot"

sec = 1000
min = 60*sec

-- Use this table to put the welcome msg to each user, it must be like i made for nErBoS
arrW = {
	["nErBoS"] = {
		["IN"] = "MSG ON LOGIN",
		["OUT"] = "MSG ON LOGOUT",
	},
}


function Main()
	frmHub:RegBot(sBot)
	frmHub:EnableFullData(1)
	SetTimer(30*min)
	StartTimer()
end

function OnTimer()
	SendToAll(sBot, GetTime())
end

function NewUserConnected(user)
	local s,e,tag,con,mail,share = strfind(user.sMyInfoString, "%$MyINFO%s+%$ALL%s+%S+%s+([^$]+)%$%s+%$([^$]*)%$([^$]*)%$([^$]+)%$")
	local sTmp = "\t--## YOUR STATS ##--\r\n\r\n"
	sTmp = sTmp.."\t?Your Nick: "..user.sName.."\r\n"
	sTmp = sTmp.."\t?Your IP: "..user.sIP.."\r\n"
	if (tag == nil) then
		sTmp = sTmp.."\t?Client: UNKNOW\r\n"
		sTmp = sTmp.."\t?Version: UNKNOW\r\n"
		sTmp = sTmp.."\t?Slots Open: UNKNOW\r\n"
	else
		local s,e,tag1 = strfind(tag, "(%b<>%b<>)")
		if (tag1 == nil) then
			local s,e,client,version,slots = strfind(tag, "<(.+)%s+V:(.+),M.+S:(%d+)")
			sTmp = sTmp.."\t?Client: <"..client.."\r\n"
			sTmp = sTmp.."\t?Version: "..version.."\r\n"
			sTmp = sTmp.."\t?Slots Open: "..slots.."\r\n"
		else
			local s,e,client,version,slots = strfind(tag, "<(%S+)(%x+.%x+)><.+S:(%d+)")
			sTmp = sTmp.."\t?Client: <"..client.."\r\n"
			sTmp = sTmp.."\t?Version: "..version.."\r\n"
			sTmp = sTmp.."\t?Slots Open: "..slots.."\r\n"
		end
	end	
	if (con == "" or con == nil) then
		sTmp = sTmp.."\t?Connection: UNKNOW\r\n"
	else
		con = strsub(con,1,strlen(con)-1)
		sTmp = sTmp.."\t?Connection: "..con.."\r\n"
	
	end
	if (share == nil or tonumber(share) == nil) then
		sTmp = sTmp.."\t?Share: UNKNOW\r\n"
	else
		if (tonumber(share) < 1) then
			share = format("%0.2f", tonumber(share)*(1024)).." MB"
		elseif (iUserShare > 1000) then
			share = format("%0.2f", tonumber(share)/(1024)).." TB"
		else
			share = share.." GB"
		end
		sTmp = sTmp.."\t?Share: "..share.."\r\n"	
	end
	if (mail == nil or mail == "") then
		sTmp = sTmp.."\t?Mail: UNKNOW\r\n"
	else
		sTmp = sTmp.."\t?Mail: "..mail.."\r\n"	
	end
	user:SendData(sBot, sTmp)
	if (arrW[user.sName] ~= nil) then
		SendToAll(sBot, arrW[user.sName]["IN"])
	end
end	

function UserDisconnected(user)
	if (arrW[user.sName] ~= nil) then
		SendToAll(sBot, arrW[user.sName]["OUT"])
	end
end

OpConnected = NewUserConnected
OpDisconnected = UserDisconnected

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 == "!time") then
			user:SendData(sBot, GetTime())
		end
	end
end

function GetTime()
	s = date("%S")
	h = date("%H")
	m = date("%M")
	d = date("%d")
	mm = date("%m")
	y = date("%y")
	Date = "Date: "..d.."/"..mm.."/20"..y.." Hour "..h..":"..m..":"..s
	return Date
end

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

SteffJay

Hi nErBoS. I have run the script, the time section is fine but there is a problem with the joining stat. When Ptokax runs, there are no errors, No syntax errors in script file C:\Program Files\Ptokax\scripts\Multi.lua but when i enter the hub this error occurs: Syntax Error: attempt to compare nil with number......  Any ideas ??. Thanks m8y.   :rolleyes:
:))

L8rz

SteffJay

nErBoS

Hi,

I have fixed in the script above, try out.

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

SteffJay

Hmmmmm..... still getting: Syntax Error: attempt to compare nil with number   from the script above !!
:))

L8rz

SteffJay

nErBoS

Hi,

I have fixed another one in the script above, i belive that you haven't mail in your settings, it should fix.

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

SteffJay

:(  Hello nErBoS. I have copied/pasted and tried the above script again but still the same error: Syntax Error: attempt to compare nil with number    I do have an email addy in my dc++ settings. The time bot is still working ok though. Thanks m8y.
:))

L8rz

SteffJay

bastya_elvtars

aint that a "version" value bug?
Everything could have been anything else and it would have just as much meaning.

nErBoS

Hi,

Which DC are you using SteffJay ??

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

SteffJay

Hello nErBoS. I run dc ++ v0.401    Robocop v7.0a  and Ptokax v0.3.2.6 Test drive 4.99
:))

L8rz

SteffJay

nErBoS

Hi,

Well...

1) I would recommend you to get ptokax TD4 and not 4.99 it has a lot of bad bugs and is not a public release.

2) Have you added any welcome msg ??? If yes show me your table please.

3) I have tested with several clients and i didn't get any error. (included dc++ 0.401).

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

SteffJay

The only Ptokax version i can find (public release) is the one i'm using now....  Ptokax v0.3.2.6 Test drive 4.99. When i d/load TD4 it is 4.99. If you have a link to 4.00 i would like to have it.... Thanks....
:))

L8rz

SteffJay

Psycho_Chihuahua

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

SteffJay

8o  Thank's Psycho_Chihuahua for the link. After i loaded it up, its the same one i'm using !!   lol  :(  Thanks anyway.
:))

L8rz

SteffJay

SteffJay

Hello nErBoS. Here is the script as amended bor use in the hub...................

----- Script Start --------------------

--## Multi BOT Adds
--## Requested by SteffJay
--## Time showed from 30 minutes to 30 minutes
--## Made by nErBoS
--## Commands:
--##   !time - Gives the current time

sBot = "Welcome"

sec = 1000
min = 60*sec

-- Use this table to put the welcome msg to each user, it must be like i made for nErBoS
arrW = {
   ["SteffJay"] = {
      ["IN"] = "Hello SteffJay",
      ["OUT"] = "Goodbye SteffJay",  },
                 ["Tommy"] = {
      ["IN"] = "Hello Tommy",
      ["OUT"] = "Goodbye Tommy",  },
                 ["Fred"] = {
      ["IN"] = "Hello Fred",
      ["OUT"] = "Goodbye Fred",  },
                 ["Jim"] = {
      ["IN"] = "Hello Jim",
      ["OUT"] = "Goodbye Jim",  },
                 ["Mino"] = {
      ["IN"] = "Hello Mino",
      ["OUT"] = "Goodbye Mino",  },
                 ["Reg"] = {
      ["IN"] = "Hello Reg",
      ["OUT"] = "Goodbye Reg",  },

}


function Main()
   frmHub:RegBot(sBot)
   frmHub:EnableFullData(1)
   SetTimer(30*min)
   StartTimer()
end

function OnTimer()
   SendToAll(sBot, GetTime())
end

function NewUserConnected(user)
   local s,e,tag,con,mail,share = strfind(user.sMyInfoString, "%$MyINFO%s+%$ALL%s+%S+%s+([^$]+)%$%s+%$([^$]

*)%$([^$]*)%$([^$]+)%$")
   local sTmp = "\t--## YOUR STATS ##--\r\n\r\n"
   sTmp = sTmp.."\t?Your Nick: "..user.sName.."\r\n"
   sTmp = sTmp.."\t?Your IP: "..user.sIP.."\r\n"
   if (tag == nil) then
      sTmp = sTmp.."\t?Client: UNKNOW\r\n"
      sTmp = sTmp.."\t?Version: UNKNOW\r\n"
      sTmp = sTmp.."\t?Slots Open: UNKNOW\r\n"
   else
      local s,e,tag1 = strfind(tag, "(%b<>%b<>)")
      if (tag1 == nil) then
         local s,e,client,version,slots = strfind(tag, "<(.+)%s+V:(.+),M.+S:(%d+)")
         sTmp = sTmp.."\t?Client: <"..client.."\r\n"
         sTmp = sTmp.."\t?Version: "..version.."\r\n"
         sTmp = sTmp.."\t?Slots Open: "..slots.."\r\n"
      else
         local s,e,client,version,slots = strfind(tag, "<(%S+)(%x+.%x+)><.+S:(%d+)")
         sTmp = sTmp.."\t?Client: <"..client.."\r\n"
         sTmp = sTmp.."\t?Version: "..version.."\r\n"
         sTmp = sTmp.."\t?Slots Open: "..slots.."\r\n"
      end
   end   
   if (con == "" or con == nil) then
      sTmp = sTmp.."\t?Connection: UNKNOW\r\n"
   else
      con = strsub(con,1,strlen(con)-1)
      sTmp = sTmp.."\t?Connection: "..con.."\r\n"
   
   end
   if (share == nil or tonumber(share) == nil) then
      sTmp = sTmp.."\t?Share: UNKNOW\r\n"
   else
      if (tonumber(share) < 1) then
         share = format("%0.2f", tonumber(share)*(1024)).." MB"
      elseif (iUserShare > 1000) then
         share = format("%0.2f", tonumber(share)/(1024)).." TB"
      else
         share = share.." GB"
      end
      sTmp = sTmp.."\t?Share: "..share.."\r\n"   
   end
   if (mail == nil or mail == "") then
      sTmp = sTmp.."\t?Mail: UNKNOW\r\n"
   else
      sTmp = sTmp.."\t?Mail: "..mail.."\r\n"   
   end
   user:SendData(sBot, sTmp)
   if (arrW[user.sName] ~= nil) then
      SendToAll(sBot, arrW[user.sName]["IN"])
   end
end   

function UserDisconnected(user)
   if (arrW[user.sName] ~= nil) then
      SendToAll(sBot, arrW[user.sName]["OUT"])
   end
end

OpConnected = NewUserConnected
OpDisconnected = UserDisconnected

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 == "!time") then
         user:SendData(sBot, GetTime())
      end
   end
end

function GetTime()
   s = date("%S")
   h = date("%H")
   m = date("%M")
   d = date("%d")
   mm = date("%m")
   y = date("%y")
   Date = "Date: "..d.."/"..mm.."/20"..y.." Hour "..h..":"..m..":"..s
   return Date
end

-------------------  Script end --------------------
:))

L8rz

SteffJay

SteffJay

Hmmmmmmmmm........ try again without the Smilies !!

--------------------------- Script Start -------------------------
--## Multi BOT Adds
--## Requested by SteffJay
--## Time showed from 30 minutes to 30 minutes
--## Made by nErBoS
--## Commands:
--##   !time - Gives the current time

sBot = "Welcome"

sec = 1000
min = 60*sec

-- Use this table to put the welcome msg to each user, it must be like i made for nErBoS
arrW = {
   ["SteffJay"] = {
      ["IN"] = "Hello SteffJay",
      ["OUT"] = "Goodbye SteffJay",  },
                 ["Tommy"] = {
      ["IN"] = "Hello Tommy",
      ["OUT"] = "Goodbye Tommy",  },
                 ["Fred"] = {
      ["IN"] = "Hello Fred",
      ["OUT"] = "Goodbye Fred",  },
                 ["Jim"] = {
      ["IN"] = "Hello Jim",
      ["OUT"] = "Goodbye Jim",  },
                 ["Mino"] = {
      ["IN"] = "Hello Mino",
      ["OUT"] = "Goodbye Mino",  },
                 ["Reg"] = {
      ["IN"] = "Hello Reg",
      ["OUT"] = "Goodbye Reg",  },

}


function Main()
   frmHub:RegBot(sBot)
   frmHub:EnableFullData(1)
   SetTimer(30*min)
   StartTimer()
end

function OnTimer()
   SendToAll(sBot, GetTime())
end

function NewUserConnected(user)
   local s,e,tag,con,mail,share = strfind(user.sMyInfoString, "%$MyINFO%s+%$ALL%s+%S+%s+([^$]+)%$%s+%$([^$]

*)%$([^$]*)%$([^$]+)%$")
   local sTmp = "\t--## YOUR STATS ##--\r\n\r\n"
   sTmp = sTmp.."\t?Your Nick: "..user.sName.."\r\n"
   sTmp = sTmp.."\t?Your IP: "..user.sIP.."\r\n"
   if (tag == nil) then
      sTmp = sTmp.."\t?Client: UNKNOW\r\n"
      sTmp = sTmp.."\t?Version: UNKNOW\r\n"
      sTmp = sTmp.."\t?Slots Open: UNKNOW\r\n"
   else
      local s,e,tag1 = strfind(tag, "(%b<>%b<>)")
      if (tag1 == nil) then
         local s,e,client,version,slots = strfind(tag, "<(.+)%s+V:(.+),M.+S:(%d+)")
         sTmp = sTmp.."\t?Client: <"..client.."\r\n"
         sTmp = sTmp.."\t?Version: "..version.."\r\n"
         sTmp = sTmp.."\t?Slots Open: "..slots.."\r\n"
      else
         local s,e,client,version,slots = strfind(tag, "<(%S+)(%x+.%x+)><.+S:(%d+)")
         sTmp = sTmp.."\t?Client: <"..client.."\r\n"
         sTmp = sTmp.."\t?Version: "..version.."\r\n"
         sTmp = sTmp.."\t?Slots Open: "..slots.."\r\n"
      end
   end   
   if (con == "" or con == nil) then
      sTmp = sTmp.."\t?Connection: UNKNOW\r\n"
   else
      con = strsub(con,1,strlen(con)-1)
      sTmp = sTmp.."\t?Connection: "..con.."\r\n"
   
   end
   if (share == nil or tonumber(share) == nil) then
      sTmp = sTmp.."\t?Share: UNKNOW\r\n"
   else
      if (tonumber(share) < 1) then
         share = format("%0.2f", tonumber(share)*(1024)).." MB"
      elseif (iUserShare > 1000) then
         share = format("%0.2f", tonumber(share)/(1024)).." TB"
      else
         share = share.." GB"
      end
      sTmp = sTmp.."\t?Share: "..share.."\r\n"   
   end
   if (mail == nil or mail == "") then
      sTmp = sTmp.."\t?Mail: UNKNOW\r\n"
   else
      sTmp = sTmp.."\t?Mail: "..mail.."\r\n"   
   end
   user:SendData(sBot, sTmp)
   if (arrW[user.sName] ~= nil) then
      SendToAll(sBot, arrW[user.sName]["IN"])
   end
end   

function UserDisconnected(user)
   if (arrW[user.sName] ~= nil) then
      SendToAll(sBot, arrW[user.sName]["OUT"])
   end
end

OpConnected = NewUserConnected
OpDisconnected = UserDisconnected

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 == "!time") then
         user:SendData(sBot, GetTime())
      end
   end
end

function GetTime()
   s = date("%S")
   h = date("%H")
   m = date("%M")
   d = date("%d")
   mm = date("%m")
   y = date("%y")
   Date = "Date: "..d.."/"..mm.."/20"..y.." Hour "..h..":"..m..":"..s
   return Date
end

------------------------ Script End ---------------------------
:))

L8rz

SteffJay

SteffJay

My apologies Psycho_Chihuahua....  Yes that is the v4.0.00b but still getting the error even when running that.... even with the original script or the one I adapted. I have even tried reg?ing nErBoS as a Master, OP, VIP and Reg, logging him in and out with each tag using both scripts and still get the same error every time......  Most confusing !!!
:))

L8rz

SteffJay

SMF spam blocked by CleanTalk