hey, i'm searching for an Onjoin script for Ptokax 16.09 only with a few info like:
Your Info:
Nick:
Ip:
Status:
Sharing:
-- script modded from "welcomemesses script by AmsterdamBulldogs" by jiten
login = {
["BotName"] = "-=Brainu=-",
}
local kb = "1024"
local mb = kb*kb
local gb = mb*kb
local tb = gb*kb
function Main()
frmHub:RegBot(login.BotName)
end
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function NewUserConnected(user)
local timeanddate = os.date("%d-%m-%Y %H:%M:%S")
local tmp = os.clock()
local weeks, days, hours, minutes, seconds = math.floor(tmp/604800), math.floor(math.mod(tmp/86400, 7)), math.floor(math.mod(tmp/3600, 24)), math.floor(math.mod(tmp/60, 60)), math.floor(math.mod(tmp/1, 60))
if frmHub:GetHubTopic() == nil then
topic = "No topic set"
else
topic = frmHub:GetHubTopic()
end
if user.sMyInfoString then
local disp = ""
doGetProfile = GetProfileName(user.iProfile) or "N?o Registado"
hubshare = string.format("%0.3f", frmHub:GetCurrentShareAmount()/(tb)).." TB"
local _,_,share = string.find(user.sMyInfoString, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $[^$]+[^$]%$[^$]*%$%s*(%d+)%$" )
if share then
minshare = string.format("%0.3f", tonumber(share)/gb).." GB"
else
minshare = "Corrupt"
end
disp = disp.."A Tua Info:\r\n"
disp = disp.." Nick: "..user.sName.."\r\n"
disp = disp.." IP: "..user.sIP.."\r\n"
disp = disp.." Status: "..doGetProfile.."\r\n"
disp = disp.." Est?s a partilhar: "..minshare.."\r\n"
msg = disp
end
end
OpConnected = NewUserConnected
function MyINFOArrival(user, data)
if not(msg==nil) then
user:SendData(msg)
msg=nil
end
end
jiten gave me this, but it sends me info on other users when connecting, and not always before the motd..
Here you go (another attempt):
-- script modded from "welcomemesses script by AmsterdamBulldogs" and Dessamator's Delaying script by jiten
-- removed unnecessary code and added table clearing
login = {
["BotName"] = "CarinaLUA5",
}
local kb = "1024"
local mb = kb*kb
local gb = mb*kb
local tb = gb*kb
tDelay={}
function Main()
frmHub:RegBot(login.BotName)
SetTimer(1000)
StartTimer()
end
--// Profile Counter
function ProfileCounter(profile)
local table, count = GetUsersByProfile(profile), 0
for i, User in table do
if GetItemByName(User) then
count = count + 1
end
end
return count
end
function NewUserConnected(user)
tDelay[user.sName] = {}
tDelay[user.sName]["time"] = "1"
end
function OnTimer()
for i,v in tDelay do
tDelay[i]["time"] = tDelay[i]["time"] - 1
if tDelay[i]["time"] == 0 then
local disp = ""
doGetProfile = GetProfileName(GetItemByName(i).iProfile) or "Not registered"
local _,_,share = string.find(GetItemByName(i).sMyInfoString, "^%$MyINFO %$ALL [^ ]+ [^$]*%$ $[^$]+[^$]%$[^$]*%$%s*(%d+)%$" )
if share then
minshare = string.format("%0.3f", tonumber(share)/gb).." GB"
else
minshare = "Corrupt"
end
border1 = " <========================= A Tua Info ================================>"
disp = "\r\n\r\n"..border1.."\r\n"
disp = disp.." ? Nick: "..GetItemByName(i).sName.."\r\n"
disp = disp.." ? IP: "..GetItemByName(i).sIP.."\r\n"
disp = disp.." ? Status: "..doGetProfile.."\r\n"
disp = disp.." ? Est?s a partilhar: "..minshare.."\r\n"
GetItemByName(i):SendData(disp)
tDelay[user.sName] = nil
end
end
end
OpConnected = NewUserConnected
*Edit* Removed unnecessary code
Cheers
Working great till now :)) thx a lot
hi, just a thought..
the tDelay table grows until hub restart since you never remove the entries, while it gets cycled every second
and if you don't intend to show hub uptime, share, topic or whatsoever, then maybe there's no need to calculate it
i get it that you copy/pasted from the scripts mentioned, but this is overkill
delayed = {}
function Main()
SetTimer(1000)
StartTimer()
end
function OnTimer()
for nick, msg in delayed do
SendToNick(nick, msg)
delayed[nick] = nil
end
end
function NewUserConnected(user)
delayed[user.sName] = string.format("Your info..\n\tnick:\t%s\n\tip:\t%s\n\tprofile:\t%s\n\tshare:\t%0.2fGB",
user.sName, user.sIP, GetProfileName(user) or "Unregistered", user.iShareSize/1024^3)
end
yw :]
QuoteOriginally posted by tezlo
hi, just a thought..
the tDelay table grows until hub restart since you never remove the entries, while it gets cycled every second
and if you don't intend to show hub uptime, share, topic or whatsoever, then maybe there's no need to calculate it
i get it that you copy/pasted from the scripts mentioned, but this is overkill
delayed = {}
function Main()
SetTimer(1000)
StartTimer()
end
function OnTimer()
for nick, msg in delayed do
SendToNick(nick, msg)
delayed[nick] = nil
end
end
function NewUserConnected(user)
delayed[user.sName] = string.format("Your info..\n\tnick:\t%s\n\tip:\t%s\n\tprofile:\t%s\n\tshare:\t%0.2fGB",
user.sName, user.sIP, GetProfileName(user) or "Unregistered", user.iShareSize/1024^3)
end
hmm...thx, but its not working, and no errors...
add this line if you want Ops to get the info..
OpConnected = NewUserConnected
QuoteOriginally posted by tezlo
add this line if you want Ops to get the info..
OpConnected = NewUserConnected
lol, thx! i'm commiting so many stupid mistakes in scripts lately..
*edited*
but its not showing profile, always says Unregistered...
easy to fix..
just replace
user.sName, user.sIP, GetProfileName(user) or "Unregistered", user.iShareSize/1024^3)
with
user.sName, user.sIP, GetProfileName(user.iProfile) or "Unregistered", user.iShareSize/1024^3)
Am I that blind today? or am I just dumb? :rolleyes:
Thx a lot madman....i'm getting insane today
np @ all...
happy to help =)
btw, beeing insane is good... just look at me... lol ;)
QuoteOriginally posted by tezlo
hi, just a thought..
the tDelay table grows until hub restart since you never remove the entries, while it gets cycled every second
and if you don't intend to show hub uptime, share, topic or whatsoever, then maybe there's no need to calculate it
i get it that you copy/pasted from the scripts mentioned, but this is overkill
Yups, u're right.
Forgot to remove the entries and other stuffs that weren't necessary. I was in the moon yesterday :D
Btw, I have updated the first post with the changes.
Cheers