Advanced Text for MOTD
 

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

Advanced Text for MOTD

Started by Metaphase, 16 March, 2004, 18:43:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Metaphase

Hi all.

I have recently made the switch from PtokaX -> YHub -> PtokaX and whilst using YHub I came accross a feature I really liked. In YHub you are able to integrate advanced text script into the motd in order to get a certain result. The one I really liked was as follows...

[adv]
Welcome . Your IP is and has been logged for security purposes only.

The result of this would be..

Welcome Metaphase. Your IP is 192.168.0.1 and has been logged for security purposes only.

Now I have made the switch to PtokaX I am really missing this cool little feature.

Is there anyway that I would be able to integrate something like this into the motd of my PtokaX Hub?

Regards,
Metaphase.

QuikThinker

I'd like to know if this is possible too?

Metaphase

#2
Would the usage of a RAW Command enable this in PtokaX motd and if so does anybody know what RAW would need to be used?

Here is an example that doesn't work but it has some effect.

|$To %[nick] From: %[mynick]$<%[mynick] Welcome to Plus44. Your IP is %[myip] and has been logged for security purposes only.|

G?M

#3
I'm not sure about doing it in the MOTD but the script would look like this:
--Your Bot's Name
Bot = "IntroBot"

-- This Registers the Bot in the userlist.
function Main()
frmHub:RegBot(Bot)
end

-- This triggers when a user enters the hub
function NewUserConnected(user)
user:SendData(Bot,"Welcome "..user.sName.." Your IP is: "..user.sIP.." and has been logged for security purposes only.")
end

--if you want ops and masters to also see the message then
function OpConnected(user)
user:SendData(Bot,"Welcome "..user.sName.." Your IP is: "..user.sIP.." and has been logged for security purposes only.")
end
The more I drink, the more I realize I like to Drink.
                                                                          -G?M

Metaphase

I will give it a try. Thanks very much for your input.

Metaphase

Works great G?M?. Thanks very much.

G?M

QuoteOriginally posted by Metaphase
Works great G?M?. Thanks very much.

No Problem :)
The more I drink, the more I realize I like to Drink.
                                                                          -G?M

Destiny

hmmm, hey there.. im new here.. but about that motd thing.. where do i put the script? in the motd itself?
thx for the help anyway  

p.s. ohh and....er... well

i'd like also to know how u put those images and drawing..'...thx    :O

[G-T-E]Gate?

Gr8 Little script.
"Big Brother Is Watching U"

billop

#9
and for introbot this the mod ?

(bad lang...)



nick =fred
ip    =xx,xx,x,x
share=32.xx
slot free=
slot occuped=
version-client=
wohis=

itz possible ?

[NL]Pur

--Introbot started by G?M?
-- 
Modded by Pur 7 may 04

Bot 
"IntroBot"

-- This Registers the Bot in the userlist.
function 
Main()
frmHub:RegBot(Bot)
end

-- This triggers when a user enters the hub
function NewUserConnected(user)

	
user:SendData(Bot,"Welcome "..user.sName.." Your IP is: "..user.sIP.." ")
	
user:SendData(Bot,"your information")
	
user:SendData(Bot,"sharesize:"..getMyInfoString(user).share)
	
user:SendData(Bot,"tag:"..getMyInfoString(user).tag)
	
user:SendData(Bot,"speed:"..getMyInfoString(user).speed)
	
user:SendData(Bot,"email:"..getMyInfoString(user).email)
	
user:SendData(Bot,"description:"..getMyInfoString(user).description)

end

--if you want ops and masters to also see the message then
function OpConnected(user)

	
user:SendData(Bot,"Welcome "..user.sName.." Your IP is: "..user.sIP.." ")
	
user:SendData(Bot,"your information")
	
user:SendData(Bot,"sharesize:"..getMyInfoString(user).share)
	
user:SendData(Bot,"tag:"..getMyInfoString(user).tag)
	
user:SendData(Bot,"speed:"..getMyInfoString(user).speed)
	
user:SendData(Bot,"email:"..getMyInfoString(user).email)
	
user:SendData(Bot,"description:"..getMyInfoString(user).description)

end


function getMyInfoString(user)

	
rettable = {
	
	
	
	
description="",
	
	
	
	
tag="",
	
	
	
	
speed="",
	
	
	
	
email="",
	
	
	
	
share=""
	
}

	
if 
user then
	
	

	
	
s,e,rettable.description,rettable.tag,rettable.speed,rettable.email,rettable.share 
	
	
	

	
	
strfind(user.sMyInfoString"$MyINFO $ALL %S+%s+(.*)<([^$]+)$ $([^$]*)$([^$]*)$([^$]+)")
	


	
end

	
if 
rettable.tag then
	
	
rettable.tag "<"..rettable.tag 
	
end

	
return 
rettable

end
 

SlasH

Works great

Thanx

[NL]Pur


billop

Thanx [NL]Pur

very good :)

witch

...i don't understend...maybe i doing something wrong, but all this scripts dosn't work on my motd  

-==i did copy/paste that way:
-- This triggers when a user enters the hub

function NewUserConnected(user)



    user:SendData(Bot,"Welcome "..user.sName.." Your IP is: "..user.sIP.." ")

    user:SendData(Bot,"your information")

    user:SendData(Bot,"sharesize:"..getMyInfoString(user).share)

    user:SendData(Bot,"tag:"..getMyInfoString(user).tag)

    user:SendData(Bot,"speed:"..getMyInfoString(user).speed)

    user:SendData(Bot,"email:"..getMyInfoString(user).email)

    user:SendData(Bot,"description:"..getMyInfoString(user).description)



end

Dosen't work! Displays all script!

-==i did copy/paste that way too:


    user:SendData(Bot,"Welcome "..user.sName.." Your IP is: "..user.sIP.." ")

    user:SendData(Bot,"your information")

    user:SendData(Bot,"sharesize:"..getMyInfoString(user).share)

    user:SendData(Bot,"tag:"..getMyInfoString(user).tag)

    user:SendData(Bot,"speed:"..getMyInfoString(user).speed)

    user:SendData(Bot,"email:"..getMyInfoString(user).email)

    user:SendData(Bot,"description:"..getMyInfoString(user).description)

Dosn't work! Displays also all script on motd!



So PLEASE tell me what i'm doing wrong!!!

Thanx for your time.



nEgativE

i think u are puting the code into the motd.txt ?!
did not understoud well.. copy the code, open a new .txt file, paste the code and save it in the ptokax script dir with extension .lua (ex: onjoin.lua) then click "restart scripts"

witch

Yes Luso THANX alot! It's works fine!

another question if you don't mind: it all comes fine, but how can i delete time and Bot tags? I would like to see it only as a text.


[10:25] Welcome ...::witch::... Your IP is: 217.330.615.92
[10:25] your information
[10:25] sharesize:35975921809
[10:25] tag:<++ V:0.401,M:A,H:2/1/0,S:7>
[10:25] speed:DSL
[10:25] email:worldoftrance@hotmail.com
[10:25] description:...::Psy zOne::... owner

Thanx a lot  :P



NightLitch

#17
here try mine:

-------------------------------------------------
-- iNFO-Bot Written by NightLitch
-------------------------------------------------
-- Usage:
--
-- [USER] = username, [IP] = ip, [HUB] = hubname, [CLIENT] = client, [VERSION] = client version,
--
-- [MODE] = client mode, [HUBS] = hubs, [SLOTS] = slots, [BANDWIDTH] = bandwidth,
--
-- [SHARE] = share (in GB), [SPEED] = speed
--
-------------------------------------------------
--// Set your filename here
MODT_FILE = "yourtextfilenamehere.txt"
-------------------------------------------------
--// Don't edit below unless you do now what you're doing...
-------------------------------------------------
function NewUserConnected(sUser)
	local MyI,Speed,Share = ParseMyInfo(sUser.sMyInfoString)
	local MODT_LINE = TextFile(MODT_FILE)
	MODT_LINE = gsub(MODT_LINE, "%b[USER]", sUser.sName)
	MODT_LINE = gsub(MODT_LINE, "%b[IP]", sUser.sIP)
	MODT_LINE = gsub(MODT_LINE, "%b[HUB]", frmHub:GetHubName())
	MODT_LINE = gsub(MODT_LINE, "%b[CLIENT]", MyI["C"])
	MODT_LINE = gsub(MODT_LINE, "%b[VERSION]", MyI["V"])
	MODT_LINE = gsub(MODT_LINE, "%b[MODE]", MyI["M"])
	MODT_LINE = gsub(MODT_LINE, "%b[HUBS]", MyI["H"])
	MODT_LINE = gsub(MODT_LINE, "%b[SLOTS]", MyI["S"])
	MODT_LINE = gsub(MODT_LINE, "%b[BANDWIDTH]", MyI["B"])
	MODT_LINE = gsub(MODT_LINE, "%b[SHARE]", format("%.2f",Share/1024/1024/1024))
	MODT_LINE = gsub(MODT_LINE, "%b[SPEED]", Speed)
	sUser:SendData(MODT_LINE)
end

function TextFile(file)
	readfrom(file, "r")
	local message = ""
	while 1 do
		local line = read()
		if line == nil then break
		else
			message = message..line.."\r\n"
		end
	end
	readfrom()
	return message
end

function ParseMyInfo(MyInfo)
	Hubs = 0
	local s,e,Speed,Share = strfind(MyInfo, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $([^$]+)[^$]%$[^$]*%$%s*(%d+)%$" )
	local s,e,Mode,tHubs,Slots = strfind(MyInfo, "M:([5AP]),H:([%d%/]+),S:(%d+)")
	if tonumber(tHubs) == nil then gsub(tHubs, "(%d+)", function (num) Hubs = Hubs +tonumber(num) end) else Hubs = tonumber(tHubs) end
	local s,e,Bandwidth = strfind(MyInfo, "[BLUF]:([%.%d]+)")
	local Client,Check,MinVer, Version = "Unknown",nil,nil,0
	for c,t in CLIENTS do
		if strfind(MyInfo, c) then
			Client = t[2]
			s,e,Version = strfind(MyInfo, t[1])
		end
	end
	if Client=="DCGUI" and tonumber(Bandwidth) then Bandwidth = Bandwidth * Slots end
	if Bandwidth==nil then Bandwidth = "Unlimited" end
	if strfind(MyInfo, "L:") then 
		if not Client=="Strong DC++" then Client = "CZDC++" end
	elseif strfind(MyInfo, "B:") then 
		if not Client=="Phantom DC++" then Client = "Bear Claw DC++" end
	end
	MyI = {["C"] = Client, ["V"] = Version, ["M"] = MODE[tostring(Mode)], ["H"] = tonumber(Hubs), ["S"] = tonumber(Slots), ["B"] = Bandwidth}
	return MyI,Speed,tonumber(Share)
end

CLIENTS = {
	["<++"] = {"V:([%d%.]+)", "DC++"},
	["oDC"] = {"V:([%d%.]+)", "oDC"},
	["", "oDC"},
	["", "iDC++"},
	["zDC++"] = {"V:([%d%.]+)", "zDC++"},
	["", "DC++ CDM"},
	["<.P"] = {"V:([%d%.]+)", "Phantom DC++"},
}
MODE = {["5"] = "Socket5", ["A"] = "Active", ["P"] = "Passive"}

Cheers / NL
//NL

witch

Yo NightLitch. Your script should be placed on scripts folder is well? As onjoin.lua? I did tried that...NO result  :(

Please explain with more ditales.

Thanx



d2thap

#19
i wanna make a raw command to ban someone, but then have a box appear so i can enter a reason, like it does for the default kick and redirect command when you are op...

can someone please tell me how!!

thanks a lot.

MrZ

This a line from my favorite.xml file



Z ya
Always remember that you are unique... just like everyone else :-D

BoJlk

[NL]Pur

Syntax error: expected;
  last token read: `<' at line 1 in file `...\scripts\IntroBot-MOD.lua'

BoJlk

And NightLitch

Your Script Doesn't Show any INFO at all!

And no Syntax error too...

[NL]Pur

it's wise to remove the at the beginning and ending. ;)

BoJlk

#24
10x

But next time isn't it better to put it as CODE...

SMF spam blocked by CleanTalk