3 New scripts required. - Page 2
 

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.

nErBoS

Hi,

I have found the problem was in the share verification, fixed...

--## 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
		share = format("%0.2f", tonumber(share)/(1024*1024*1024))
		if (tonumber(share) < 1) then
			share = format("%0.2f", tonumber(share)*(1024)).." MB"
		elseif (tonumber(share) > 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

:D  Hey nErBoS.....  Your a STAR...  The script now works great, thanks for your help with this, its much appreciated m8y !!. Good luck with your exams... !!  :))
:))

L8rz

SteffJay

SteffJay

Hello nErBoS. I have one question: this welcome message for Test has been added to the script:

-----------------------  Script  ----------------------------

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

sBot = "Admin"

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"] = "Welcome back nErBoS",
      ["OUT"] = "Goodbye nErBoS",
},

arrW = {
   ["Test"] = {
      ["IN"] = "Welcome Test",
      ["OUT"] = "Goodbye Test",
}

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,    etc, etc .......

------------------------- end of script --------------------

Syntax Error: `}' expected (to close `{' at line 20);
  last token read: `function' at line 26 in file `C:\Program Files\Ptokax\scripts\Test.lua'            Why ?

It was copy/pasted from above. Can you give me the proper syntax for the above script please !!.  Thanks m8y.
:))

L8rz

SteffJay

BottledHate

here's an example of how a table should look for this script....

arrW = { 
   ["nErBoS"] = { 
      ["IN"] = "Welcome back nErBoS", 
      ["OUT"] = "Goodbye nErBoS", 
   }, 
   ["Test"] = { 
      ["IN"] = "Welcome Test", 
      ["OUT"] = "Goodbye Test", 
   },
   ["Test2"] = { 
      ["IN"] = "Welcome Test2", 
      ["OUT"] = "Goodbye Test2", 
   },
   ["Test3"] = { 
      ["IN"] = "Welcome Test3", 
      ["OUT"] = "Goodbye Test3", 
   },
   ["Test4"] = { 
      ["IN"] = "Welcome Test4", 
      ["OUT"] = "Goodbye Test4", 
   },
}

hope this helps!

-BH
Homepage: www.bottledhate.webhop.org

Compiling  Lua scripts is LAME!!!!!

SteffJay

Hmmmmm....  don't work.....
:))

L8rz

SteffJay

nErBoS

Hi,

This is wrong....

arrW = { 
["nErBoS"] = { 
["IN"] = "Welcome back nErBoS", 
["OUT"] = "Goodbye nErBoS", 
}, 

arrW = { 
["Test"] = { 
["IN"] = "Welcome Test", 
["OUT"] = "Goodbye Test", 
}

Should be like this...

arrW = { 
	["nErBoS"] = { 
		["IN"] = "Welcome back nErBoS", 
		["OUT"] = "Goodbye nErBoS", 
	}, 
	["Test"] = { 
		["IN"] = "Welcome Test", 
		["OUT"] = "Goodbye Test", 
	},
}

Just like BH has written.

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

SteffJay

I will give it a bash.........
:))

L8rz

SteffJay

SteffJay

Hello, nErBoS & BottledHate......  success !!!!   The script works a dream !!   Thanks to you two guy's...   ;)  Thank's again !!
:))

L8rz

SteffJay

SMF spam blocked by CleanTalk