Ptokax Scripts, a few easy scripts will be added here.
 

Ptokax Scripts, a few easy scripts will be added here.

Started by [ES]latinmusic, 20 October, 2003, 19:56:34

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

[ES]latinmusic

I'm currently rewriting all the bots of our net, so i will post here in this thread some scripts for if people find them interesting or usefull or just wanna to take a look or test them. I have forgot the name of many original scripters who made the original code taking as base for this stuff, surry about that, anyway if you are the original developer about a part of the code, make a reply and i will change the credits, no problem at all :p Also i want to thanks AmuteX about his help in some modifications or adds that could be present on some scripts posted here.

[ES]latinmusic

Tested and works.
-------------------------------------------------------------------------------------------------------
-- ![NetStatus]!? script - v1.1 - Created by [ES]latinmusic __/04/2003
-- Powered by ARACNIDOS.NET?  -  No Rights Reserved
-- Thanks go out to all people from LUA Board, old and new one
-- Some of the original code was developed by some one i don't remember
-- If you were envolving in this code, tell me and you will be added into credits
-- Multilanguage Version (Spanish & English)
-- ****************************************************************************************************
-- This Script: Show if the hubs listed inside the array are online or offline in real time
-- Could be usefull if you are running a net of hubs or you wanna see if your friends hubs are online
-- Command for this script '-netstat'
-- To set up this script working under your needs, read the help inside the code
-- Enjoy...
-------------------------------------------------------------------------------------------------------
------- Main function -------
function Main()
botName="![NetStatus]!?" --//Help: Name of the bot.
--frmHub:RegBot(botName) --//Help: This line is not requiered, is only a comment for Ptacek.
CoolLine=strrep("-",250) --//Help: This line could be nosense for the upcoming release in test of PtokaX since code about PMs have been change, in this case remove it from the script.
waitmessage=strrep(" ...WAIT...ESPERE... ",6) --//Help: Same of above. If you delete those lines, also you have to delete the variables related from the script in messages part
--------- HubsArrayHelp --------
-------Formating the array------
-- HubAddress = {
-- ["Hub{0} Name Of The Hub] =			Change 'Name Of The Hub' to the real hub name
-- address= "Address Of The Hub",		Change 'Address Of The Hub' to the real hub address
-- port = Port Of The Current Hub,		Change 'Port Of The Current Hub' to the real hub port
-- },						For examples take a look into the following lines
--------- HubsArrayHelp --------
HubAddress = {
["Hub{0} ?ARACNIDOS?-=MAIN SERVER=-?"] = { --//Help: Put here the real name of the HUB
address= "aracnidos.no-ip.com", --//Help: Put here the real address  of the HUB
port = 411, --//Help: Put here the real port of the HUB
},
["Hub{1} ?ARACNIDOS#1?-=SUPPORT SERVER=-?"] = { --//Help: Put here the real name of the HUB
address= "aracnidos1.no-ip.com", --//Help: Put here the real address of the HUB
port = 411, --//Help: Put here the real port of the HUB
},
["Hub{2} ?ARACNIDOS#2?-=SUPPORT SERVER=-?"] = { --//Help: Put here the real name of the HUB
address= "aracnidos2.no-ip.com", --//Help: Put here the real address of the HUB
port = 411, --//Help: Put here the real port of the HUB
},
["Hub{3} ?ARACNIDOS#3?-=SUPPORT SERVER=-?"] = { --//Help: Put here the real name of the HUB
address= "aracnidos3.no-ip.com", --//Help: Put here the real address of the HUB
port = 411, --//Help: Put here the real port of the HUB
},
["Hub{4} ?ARACNIDOS#4?-=SUPPORT SERVER=-?"] = { --//Help: Put here the real name of the HUB
address= "aracnidos4.no-ip.com", --//Help: Put here the real address of the HUB
port = 411, --//Help: Put here the real port of the HUB
}
} 
end
function DataArrival(user, data) 
	if( strsub(data, 1, 1) == "<" ) then
		-- get the msg only using regular expression
		s,e,message = strfind(data, "%b<> (.*)")
		--remove pipe
		message = strsub(message,1,strlen(message)-1) 
		s,e,cmd=strfind(message,"(%S+)")
		if (cmd=="-netstat")then 
			for i,v in HubAddress do
				user:SendPM(botName,"\r\nRequesting Net Information for "..i.."\r\nPlease "..waitmessage.."\r\n")
				local socket, err = connect(v["address"], v["port"])
				if not err then socket:close()
					status = "<----------------------------> {{**ONLINE**}}"
				else
					status = "<----------------------------> {{**OFFLINE**}}   :-("
				end
				user:SendPM(botName,"\r\n"..CoolLine.."\r\n"..i.."\r\n<> Address: "..v["address"].."\r\n<> Port:"..v["port"].."\r\n<> Status: "..status.."\r\n"..CoolLine.."\r\n")
			end
			user:SendPM(botName,"The request for Online/Offline Hubs have been completed [El chequeo de HUBs Conectados/Desconectados ha concluido]\r\n")
		end
	end
end
--function OnExit() --//Help: This line is not requiered, is only a comment for Ptacek.
--	frmHub:UnregBot(botName) --//Help: This line is not requiered, is only a comment for Ptacek.
--end --//Help: This line is not requiered, is only a comment for Ptacek.

pHaTTy

I really dont see the point of posting scripts that have been already posted its pointless and a waste of forum space, if there is a script that has not been posted, then it wud be better in the finished script section.

But on the other hand if the script has been posted then i wouldnt bother posting it.

-phatty
Resistance is futile!

[ES]latinmusic

If not work, ask for help, this board seems not support non standar characters and change them by sign '?'  X(

[ES]latinmusic

QuoteOriginally posted by (uk-kingdom)pH?tt??
I really dont see the point of posting scripts that have been already posted its pointless and a waste of forum space, if there is a script that has not been posted, then it wud be better in the finished script section.
I don't think the scripts i'm posting here are already posted in the board, in the case of the current one, was never posted in old forum board too.
About the place this thread is called Scripts for 3.2.6 or later and works with 3.2.6 official releases, not official releases and also with all latest beta releases. So i don't catch what is wrong here  ?(
Anyway, do what you want, move the post to thread finished scripts, leave the post here, delete the post or whatever, i have made this posts for if someone are interested with the code, after that, i don't really care.

[ES]latinmusic

Tested and works.
-------------------------------------------------------------------------------------------------------
-- ![UserInfo]!? script - v0.9 - Created by [ES]latinmusic __/05/2003
-- Powered by ARACNIDOS.NET?  -  No Rights Reserved
-- Totally based on template.lua from sedulus
-- Multilanguage Version (Spanish & English)
-- ****************************************************************************************************
-- This Script: Retrieve some information when a user or an op connect into the hub
-- and display the information recollected into the main chat. Only works with ++ clients.
-- This script is no apropiated for large hubs since the message is displayed into the main chat but,
-- can be easily modify to your needs
-- Enjoy...
-------------------------------------------------------------------------------------------------------
function Main()
	Bot="![UserInfo]!?"
	hubCheckMethod = 3	-- dc++024 Hub notation: 1=x, 2=x/y, 3=x/y/z
	kb = 1024
	mb = kb*kb
	gb = kb*kb*kb
	tb = kb*kb*kb*kb
end
function NewUserConnected(user)
	CheckPlusPlus(user) 
end
function OpConnected(user)
	CheckPlusPlus(user) 
end
function CheckPlusPlus(user) 
	if strfind(user.sMyInfoString,"<++") then
		CheckMyInfo(user, user.sMyInfoString)
	end
end 
function CheckMyInfo( user, myInfo )
	local ret,c,dcppTag,speed,share = strfind( myInfo,
		"^%$MyINFO %$ALL [^ ]+ [^$]*<%+%+ ([^$<>]+)>%$ $([^$]+)[^$]%$[^$]*%$(%d+)%$" )
	share = tonumber( share )
	local dcppFlags = {}
	dcppTag = dcppTag..","
	gsub( dcppTag, "(.):([^,]+),", function( letter, value ) %dcppFlags[letter] = value ; end )
	if dcppFlags["M"] == "P" then
		DCmode= "Passive [Pasivo]"
	else
		DCmode= "Active [Activo]"
	end
	local tmp = {0}
	gsub( dcppFlags["H"], "(%d+)", function( x ) %tmp[1] = %tmp[1] + tonumber( x ) end, hubCheckMethod )
	dcppFlags["H"],tmp = tmp[1],nil
	if share < mb then
		ShareAmount = (floor((share/kb)*100))/100
		ShareUnit = "KBs"
	elseif share >= mb and share < gb then
		ShareAmount = (floor((share/mb)*100))/100
		ShareUnit = "MBs"
	elseif share >= gb and share < tb then
		ShareAmount = (floor((share/gb)*100))/100
		ShareUnit = "GBs"
	elseif share >= tb then
		ShareAmount = (floor((share/tb)*100))/100
		ShareUnit = "TBs"
	end
	SendToAll(Bot,"\r\nConnections Tips...\r\nDatos de conexi?n de "..user.sName..":\r\n<> Client Version [Versi?n del cliente]: "..dcppFlags["V"]..".\r\n<> Mode [Modo]: "..DCmode..".\r\n<> Open Slots [Slots abiertos]: "..dcppFlags["S"]..".\r\n<> Connected to [Conectado a]: "..dcppFlags["H"].." Hub/s.\r\n<> Conection type [Tipo de conexi?n]: "..speed..".\r\n<> Sharing [Compartiendo]: "..ShareAmount.." "..ShareUnit..".\r\n" )
end

Alexei

hmm...
Can you please tell my WHY will anyone want that script... whats the point of it???
Dont get it... ?(

pHaTTy

QuoteOriginally posted by Alexei
hmm...
Can you please tell my WHY will anyone want that script... whats the point of it???
Dont get it... ?(

to give userinfo hence its called userinfo
Resistance is futile!

Alexei

I can see that...but... but u can get it different ways!
Plus its annoying whe a msg is sent in a main chat... EVERY user!!!! getting in the hub! gosh....

klownietklowniet

Hihi.. can agree that is not such a good idea... SendPmToNick would be better... or user:SendPM....
[ > DC - UniteD < ]

[ES]latinmusic

Those script are posted for if anyone find them usefull, also you can take the code as an example to use them for different stuff, is only an example and works.
In my case the second one is used to test hubs and waste resources to see if the hub crash for instance.
I'm tired of this. Since not one can see the point, i stop posting scripts, so don't take care about me, i'l be totally quite.  :O

Typhoon

i was just woundering why people are being so hostile in the most post at this forum, instead of just sharing their knowledge and enjoy the great work some of you guys do....  not the right dc/lua spirit i think    X(



plop

QuoteOriginally posted by Typhoon?
i was just woundering why people are being so hostile in the most post at this forum, instead of just sharing their knowledge and enjoy the great work some of you guys do....  not the right dc/lua spirit i think    X(
totaly agree.
if you like the scrips use it if not fine.
every1 likes things in there own way and you have 2 respect that.
every script is welcome, always good 2 look @ them.
you never know where you can get a new idea from wich you can use yourself.
pls stop this childish fighting and start helping/respecting oneanother.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

pHaTTy

QuoteOriginally posted by plop
QuoteOriginally posted by Typhoon?
i was just woundering why people are being so hostile in the most post at this forum, instead of just sharing their knowledge and enjoy the great work some of you guys do....  not the right dc/lua spirit i think    X(
totaly agree.
if you like the scrips use it if not fine.
every1 likes things in there own way and you have 2 respect that.
every script is welcome, always good 2 look @ them.
you never know where you can get a new idea from wich you can use yourself.
pls stop this childish fighting and start helping/respecting oneanother.

plop


very well said, i think if a thread starts turning nasty it will me closed until they agree to act like as the way they should, and get there spirit back, lets all just shake hands and get on with our lives.......:o)

:o)\
Resistance is futile!

mOrrI

welll calm down boys... lol..

there is solutions to all...

ZIP THE remaked scripts and put them online then there will be only one post with the links.... :p

PS- i can host the zip files :p

Sudds

Yeh grate idea. get a site with all the scripts on and wel all be happy. hehe. Keep up da good work all u script makers lol.
Sudds

SMF spam blocked by CleanTalk