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.
I'd like to know if this is possible too?
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.|
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
I will give it a try. Thanks very much for your input.
Works great G?M?. Thanks very much.
QuoteOriginally posted by Metaphase
Works great G?M?. Thanks very much.
No Problem :)
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
Gr8 Little script.
"Big Brother Is Watching U"
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 ?
--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
Works great
Thanx
yw
Thanx [NL]Pur
very good :)
...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.
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"
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
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"},
[" [" ["http://dc.ketelhot.de"] = {"V:([%d%.]+)", "DCGUI"},
[" [" [" ["", "iDC++"},
["zDC++"] = {"V:([%d%.]+)", "zDC++"},
[" ["", "DC++ CDM"},
["<.P"] = {"V:([%d%.]+)", "Phantom DC++"},
}
MODE = {["5"] = "Socket5", ["A"] = "Active", ["P"] = "Passive"}
Cheers / NL
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
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.
This a line from my favorite.xml file
Z ya
[NL]Pur
Syntax error: expected;
last token read: `<' at line 1 in file `...\scripts\IntroBot-MOD.lua'
And NightLitch
Your Script Doesn't Show any INFO at all!
And no Syntax error too...
it's wise to remove the at the beginning and ending. ;)
10x
But next time isn't it better to put it as CODE...
Yay, I've noticed [NL]Pur's (and others') code posts before... True, [ code ] is the usual method, but i tend to find that [ php] is prettier, and maybe even more readable ;) I've thought before about the fact that it could confuse people, though... but it's the 1st time i notice a remark to that effect.
i agree with bolamix , it's looking alot nicer,
and if you not only read the error but also thought a few secs about it you could have solved it yourself.
...okey [NL]Pur i'll know for next time...
so then tell me exactly what you want
onjoin info on user?
user commands sent from hhub to client?
both?
what?
?(
Personally me.
I would like for a user to see his own statistics
like
your share is: xxx
you are in: xxx many hubs
etc.
QuoteOriginally posted by BoJlk
Personally me.
I would like for a user to see his own statistics
like
your share is: xxx
you are in: xxx many hubs
etc.
personally i like the idea, i put it into lawmaker, but a.i. and nxs contain it too, and i guess many more greater scripts than mine.
i dont know if this is an option in robocop, it would be nice to have. request that feature, opti will surely implement it if its not there
the only problem is that MOTD is sent before script execution, so first u see the MOTD, then u se what the script tells u on connection, so better not put this in motd, rather put into RC or whatever.
this motd thingy in yhub is to resolve the non-scriptable program. personally im sick of yhub, it consumes cpu and there is lackl of features that i.e. verli has. In ptokax such features can be reached by scripting.
onjoin info is also available in my signature ;o)
Typhoon?
QuoteOriginally posted by Typhoon?
onjoin info is also available in my signature ;o)
Typhoon?
hey mods
please delete self-advertisements! bleeeeeeeeeeeeeeh
:D :D :D :D :D :D :D :D :D :D :D :D
bastya_elvtars You should know... :D :D :D
--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.." ")
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
I want it to look some thing like this
----------------
your user name is : XXX
your IP is : XXXXXXXXX
your share size is : XXXXXXXXXXXXXX
Your email is :XXXXXXXXXXXXXXXXXXXXXX
Your descipstion is : XXXXXXXXXXXXX
and some on
search the forum and you will see lots of this kind of bots you want you can configure those by your own if not then say whats your problem is and we will help
cheers
QuoteOriginally posted by stewpot_smile2005
--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.." ")
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
I want it to look some thing like this
----------------
your user name is : XXX
your IP is : XXXXXXXXX
your share size is : XXXXXXXXXXXXXX
Your email is :XXXXXXXXXXXXXXXXXXXXXX
Your descipstion is : XXXXXXXXXXXXX
and some on
I'm not quit sure what u actually want but from what i gather you just wanted an edit on that script so here you go:
--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,"your information")
user:SendData(Bot,"your username is: "..user.sName.." ")
user:SendData(Bot,"your IP is: "..user.sIP.." ")
user:SendData(Bot,"your sharesize is: "..getMyInfoString(user).share)
user:SendData(Bot,"your email is:"..getMyInfoString(user).email)
user:SendData(Bot,"your description is: "..getMyInfoString(user).description)
user:SendData(Bot,"your connection is: "..getMyInfoString(user).speed)
user:SendData(Bot,"your tag is: "..getMyInfoString(user).tag)
end
Not tested (only for Syntax with Ptx Hubsoft)
I will post my variant ... hope it helps ...
Bot = frmHub:GetHubBotName()
linii = "-----------------------------------------------"
function NewUserConnected(user)
user:SendData(Bot,"////////////////////////////"..linii)
user:SendData(Bot," -[ [ [ Znup Bot ver. 0.2 ] ] ]-")
user:SendData(Bot," DeVeloPeD bY ZnuPi")
user:SendData(Bot," http://znupi.sytes.net")
user:SendData(Bot," -[ [ [ Znup Bot ver. 0.2 ] ] ]-")
user:SendData(Bot,"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"..linii)
user:SendData(Bot,"-----------------------------------------------"..linii)
user:SendData(Bot,"////////////////////////////")
user:SendData(Bot," llllllll YOUR INFO llllllll")
user:SendData(Bot,"Nick: "..user.sName)
user:SendData(Bot,"IP: "..user.sIP)
user:SendData(Bot,"Client: "..user.sClient.." "..user.sClientVersion)
if (user.sMode=="P") then
user:SendData(Bot,"Mode : Passive")
end
if (user.sMode=="A") then
user:SendData(Bot,"Mode : Active")
end
user:SendData(Bot,"ShareSize : "..user.iShareSize.." B")
user:SendData(Bot,"Profile : Regular User")
user:SendData(Bot,"You are in "..user.iHubs.." hubs with "..user.iSlots.." slots")
user:SendData(Bot," llllllll YOUR INFO llllllll")
user:SendData(Bot,"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"..linii)
user:SendData(Bot,"-----------------------------------------------"..linii)
user:SendData(Bot,"////////////////////////////"..linii)
user:SendData(Bot," llllllllll HUB INFO llllllllll")
user:SendData(Bot,"Name : "..frmHub:GetHubName())
user:SendData(Bot,"Topic : "..title)
user:SendData(Bot,"Users : "..frmHub:GetUsersCount())
user:SendData(Bot,"Hub Bot : "..frmHub:GetHubBotName())
user:SendData(Bot," llllllllll HUB INFO llllllllll")
user:SendData(Bot,"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"..linii)
end
and the output of this is ...
<Da'ZnuP'BoT> ////////////////////////////-----------------------------------------------
<Da'ZnuP'BoT> -[ [ [ Znup Bot ver. 0.2 ] ] ]-
<Da'ZnuP'BoT> DeVeloPeD bY ZnuPi
<Da'ZnuP'BoT> http://znupi.sytes.net
<Da'ZnuP'BoT> -[ [ [ Znup Bot ver. 0.2 ] ] ]-
<Da'ZnuP'BoT> \\\\\\\\\\\\\\\\\\\\\\\\\\\\-----------------------------------------------
<Da'ZnuP'BoT> ----------------------------------------------------------------------------------------------
<Da'ZnuP'BoT> ////////////////////////////
<Da'ZnuP'BoT> llllllll YOUR INFO llllllll
<Da'ZnuP'BoT> Nick: [RO][-Znupi-]
<Da'ZnuP'BoT> IP: 127.0.0.1
<Da'ZnuP'BoT> Client: DC++ 0.674
<Da'ZnuP'BoT> Mode : Passive
<Da'ZnuP'BoT> ShareSize : 0 B
<Da'ZnuP'BoT> Profile : Regular User
<Da'ZnuP'BoT> You are in 8 hubs with 10 slots
<Da'ZnuP'BoT> llllllll YOUR INFO llllllll
<Da'ZnuP'BoT> \\\\\\\\\\\\\\\\\\\\\\\\\\\\-----------------------------------------------
<Da'ZnuP'BoT> ----------------------------------------------------------------------------------------------
<Da'ZnuP'BoT> ////////////////////////////-----------------------------------------------
<Da'ZnuP'BoT> llllllllll HUB INFO llllllllll
<Da'ZnuP'BoT> Name : PalaSh e un idiot
<Da'ZnuP'BoT> Topic : PalaSh e un mare idiot
<Da'ZnuP'BoT> Users : 1
<Da'ZnuP'BoT> Hub Bot : Da'ZnuP'BoT
<Da'ZnuP'BoT> llllllllll HUB INFO llllllllll
<Da'ZnuP'BoT> \\\\\\\\\\\\\\\\\\\\\\\\\\\\-----------------------------------------------
Hope I helped! :)
sry for advertising ... you can delete those lines... :D
Oh, and another thing ... If u want to send a customized message before "This hub is running PtokaX DC Hub 0.3.4.0 [debug] (UpTime: 0 days, 0 hours, 14 minutes)" ... u should make it this way :
function GetNickListArrival(user,data)
user:SendData(Bot,"Insert welcome message here")
end
This way ye old "This hub is running PtokaX DC Hub 0.3.4.0 [debug] (UpTime: 0 days, 0 hours, 14 minutes)" will be the second message in ur hub, thus the welcome message discplayed in hublist.org will be customized! :D
Quote from: Znupi on 10 June, 2006, 13:02:29
I will post my variant ... hope it helps ...
Bot = frmHub:GetHubBotName()
linii = "-----------------------------------------------"
function NewUserConnected(user)
user:SendData(Bot,"////////////////////////////"..linii)
user:SendData(Bot," -[ [ [ Znup Bot ver. 0.2 ] ] ]-")
user:SendData(Bot," DeVeloPeD bY ZnuPi")
user:SendData(Bot," http://znupi.sytes.net")
user:SendData(Bot," -[ [ [ Znup Bot ver. 0.2 ] ] ]-")
user:SendData(Bot,"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"..linii)
user:SendData(Bot,"-----------------------------------------------"..linii)
user:SendData(Bot,"////////////////////////////")
user:SendData(Bot," llllllll YOUR INFO llllllll")
user:SendData(Bot,"Nick: "..user.sName)
user:SendData(Bot,"IP: "..user.sIP)
user:SendData(Bot,"Client: "..user.sClient.." "..user.sClientVersion)
if (user.sMode=="P") then
user:SendData(Bot,"Mode : Passive")
end
if (user.sMode=="A") then
user:SendData(Bot,"Mode : Active")
end
user:SendData(Bot,"ShareSize : "..user.iShareSize.." B")
user:SendData(Bot,"Profile : Regular User")
user:SendData(Bot,"You are in "..user.iHubs.." hubs with "..user.iSlots.." slots")
user:SendData(Bot," llllllll YOUR INFO llllllll")
user:SendData(Bot,"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"..linii)
user:SendData(Bot,"-----------------------------------------------"..linii)
user:SendData(Bot,"////////////////////////////"..linii)
user:SendData(Bot," llllllllll HUB INFO llllllllll")
user:SendData(Bot,"Name : "..frmHub:GetHubName())
user:SendData(Bot,"Topic : "..title)
user:SendData(Bot,"Users : "..frmHub:GetUsersCount())
user:SendData(Bot,"Hub Bot : "..frmHub:GetHubBotName())
user:SendData(Bot," llllllllll HUB INFO llllllllll")
user:SendData(Bot,"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"..linii)
end
and the output of this is ...
<Da'ZnuP'BoT> ////////////////////////////-----------------------------------------------
<Da'ZnuP'BoT> -[ [ [ Znup Bot ver. 0.2 ] ] ]-
<Da'ZnuP'BoT> DeVeloPeD bY ZnuPi
<Da'ZnuP'BoT> http://znupi.sytes.net
<Da'ZnuP'BoT> -[ [ [ Znup Bot ver. 0.2 ] ] ]-
<Da'ZnuP'BoT> \\\\\\\\\\\\\\\\\\\\\\\\\\\\-----------------------------------------------
<Da'ZnuP'BoT> ----------------------------------------------------------------------------------------------
<Da'ZnuP'BoT> ////////////////////////////
<Da'ZnuP'BoT> llllllll YOUR INFO llllllll
<Da'ZnuP'BoT> Nick: [RO][-Znupi-]
<Da'ZnuP'BoT> IP: 127.0.0.1
<Da'ZnuP'BoT> Client: DC++ 0.674
<Da'ZnuP'BoT> Mode : Passive
<Da'ZnuP'BoT> ShareSize : 0 B
<Da'ZnuP'BoT> Profile : Regular User
<Da'ZnuP'BoT> You are in 8 hubs with 10 slots
<Da'ZnuP'BoT> llllllll YOUR INFO llllllll
<Da'ZnuP'BoT> \\\\\\\\\\\\\\\\\\\\\\\\\\\\-----------------------------------------------
<Da'ZnuP'BoT> ----------------------------------------------------------------------------------------------
<Da'ZnuP'BoT> ////////////////////////////-----------------------------------------------
<Da'ZnuP'BoT> llllllllll HUB INFO llllllllll
<Da'ZnuP'BoT> Name : PalaSh e un idiot
<Da'ZnuP'BoT> Topic : PalaSh e un mare idiot
<Da'ZnuP'BoT> Users : 1
<Da'ZnuP'BoT> Hub Bot : Da'ZnuP'BoT
<Da'ZnuP'BoT> llllllllll HUB INFO llllllllll
<Da'ZnuP'BoT> \\\\\\\\\\\\\\\\\\\\\\\\\\\\-----------------------------------------------
Hope I helped! :)
why not make it into a string instead of beating the shit out of the userobject so f**king many times ?? ..
something like this for example ..
SendAdMessage = function()
local border1 = "\t===========H=U=B==I=N=F=O==========="
local border2 = "\t====================================="
local tosend = "\r\n\r\n"..border1.."\r\n"..
" ?Hub Owner: "..tSetup.HubInfo.Owner.."\r\n"..
" ?Hub Name: "..frmHub:GetHubName().."\r\n"..
" ?Hub Address: "..tSetup.HubInfo.HubAddy.."\r\n"..
" ?Web Address: "..tSetup.HubInfo.HomePage.."\r\n"..
" ?Complain @: "..tSetup.HubInfo.Complaint_Email.."\r\n"..
" ?Hub Network: +network".."\r\n"..
" ?Help Menu: +help".."\r\n"..
" ?Hub Rules: +rules".."\r\n"..border2.."\r\n"
SendToAll(tSetup.Bots.BotName,tosend)
end,
cheers Typhoon?
There's more than one way to acheiving something ... and yes, the one string idea is better ... but I don't use PtokaX as my hubsoft, I use YnHub instead, I only use PtokaX to make LUA scripts 'coz I like the language ... and I think it looks cooler my way ... oh well ...
Quote from: Znupi on 10 June, 2006, 23:34:56
There's more than one way to acheiving something ... and yes, the one string idea is better ... but I don't use PtokaX as my hubsoft, I use YnHub instead, I only use PtokaX to make LUA scripts 'coz I like the language ... and I think it looks cooler my way ... oh well ...
sure it could be that it looks better your way, but all those object calls are quite a waste and waste resembles in memory leak and so on..
i guess you're here to find out more about Lua, then you should check out the above functions and do some memory/time testing to see the results...
by calling the same user object for 27 times is in my opinion a very poor way of doing it..
but check it out a bit and give some feed back..
Ok ... so if I understood right ... you're suggesting something more like :
function NewUserConnected(user)
if (user.sMode == "P") then
mode = "Passive"
end
if (user.sMode == "A") then
mode = "Active"
end
local linii = "-----------------------------------------------"
local slash = "////////////////////////////"
local bslash = "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
local motd = "\r\n\r\n\t\t"..slash..linii.."\r\n"..
"\t\t -[ [ [ Znup BoT ver. 0.2 ] ] ]-\r\n"..
"\t\t DeVeloPeD bY ZnuPi\r\n"..
"\t\t http://znupi.sytes.net\r\n"..
"\t\t"..bslash..linii.."\r\n"..
"\t\t"..linii..linii.."\r\n"..
"\t\t"..slash..linii.."\r\n"..
"\t\t llllllll YOUR INFO llllllll\r\n"..
"\t\tNick: "..user.sName.."\r\n"..
"\t\tIP: "..user.sIP.."\r\n"..
"\t\tClient: "..user.sClient.." "..user.sClientVersion.."\r\n"..
"\t\tMode: "..mode.."\r\n"..
"\t\tSharesize: "..user.iShareSize.." B\r\n"..
"\t\tProfile: Regular User\r\n"..
"\t\tYou are in "..user.iHubs.." hubs with "..user.iSlots.." slots\r\n"..
"\t\t llllllll YOUR INFO llllllll\r\n"..
"\t\t"..bslash..linii.."\r\n"..
"\t\t"..linii..linii.."\r\n"..
"\t\t"..slash..linii.."\r\n"..
"\t\t llllllllll HUB INFO llllllllll\r\n"..
"\t\tName: "..frmHub:GetHubName().."\r\n"..
"\t\tTopic: "..title.."\r\n"..
"\t\tUsers: "..frmHub:GetUsersCount().."\r\n"..
"\t\tHub Bot: "..frmHub:GetHubBotName().."\r\n"..
"\t\t llllllllll HUB INFO llllllllll\r\n"..
"\t\t"..bslash..linii.."\r\n"
user:SendData(Bot,motd)
end
Is that better? ;D
Quote from: Znupi on 11 June, 2006, 12:25:50
Ok ... so if I understood right ... you're suggesting something more like :
function NewUserConnected(user)
if (user.sMode == "P") then
mode = "Passive"
end
if (user.sMode == "A") then
mode = "Active"
end
local linii = "-----------------------------------------------"
local slash = "////////////////////////////"
local bslash = "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
local motd = "\r\n\r\n\t\t"..slash..linii.."\r\n"..
"\t\t -[ [ [ Znup BoT ver. 0.2 ] ] ]-\r\n"..
"\t\t DeVeloPeD bY ZnuPi\r\n"..
"\t\t http://znupi.sytes.net\r\n"..
"\t\t"..bslash..linii.."\r\n"..
"\t\t"..linii..linii.."\r\n"..
"\t\t"..slash..linii.."\r\n"..
"\t\t llllllll YOUR INFO llllllll\r\n"..
"\t\tNick: "..user.sName.."\r\n"..
"\t\tIP: "..user.sIP.."\r\n"..
"\t\tClient: "..user.sClient.." "..user.sClientVersion.."\r\n"..
"\t\tMode: "..mode.."\r\n"..
"\t\tSharesize: "..user.iShareSize.." B\r\n"..
"\t\tProfile: Regular User\r\n"..
"\t\tYou are in "..user.iHubs.." hubs with "..user.iSlots.." slots\r\n"..
"\t\t llllllll YOUR INFO llllllll\r\n"..
"\t\t"..bslash..linii.."\r\n"..
"\t\t"..linii..linii.."\r\n"..
"\t\t"..slash..linii.."\r\n"..
"\t\t llllllllll HUB INFO llllllllll\r\n"..
"\t\tName: "..frmHub:GetHubName().."\r\n"..
"\t\tTopic: "..title.."\r\n"..
"\t\tUsers: "..frmHub:GetUsersCount().."\r\n"..
"\t\tHub Bot: "..frmHub:GetHubBotName().."\r\n"..
"\t\t llllllllll HUB INFO llllllllll\r\n"..
"\t\t"..bslash..linii.."\r\n"
user:SendData(Bot,motd)
end
Is that better? ;D
U could use string.rep 4 this
local linii = "-----------------------------------------------"
local slash = "////////////////////////////"
local bslash = "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"
Check the lua 5 manual :-)
Where can I find that ? ;D