PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: No0bie on 18 October, 2003, 20:15:05

Title: How ??
Post by: No0bie on 18 October, 2003, 20:15:05
How can I make this send the information to users in a PM??

sBotName = "Information"

frmHub:RegBot(sBotName)

 

function CountMASTERs()
local tmp, online = GetUsersByProfile(GetProfileName(0)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end

function CountOPs()
local tmp, online = GetUsersByProfile(GetProfileName(1)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end


function CountVIPs()
local tmp, online = GetUsersByProfile(GetProfileName(2)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end

function CountRegs()
local tmp, online = GetUsersByProfile(GetProfileName(3)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end

function OpConnected(user)
local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: retreat.redirectme.net\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Users Online: "..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..CountMASTERs().."\r\n"
tmp = tmp.."\t??? Operators Online: "..CountOPs().."\r\n"
tmp = tmp.."\t??? VIPs Online: "..CountVIPs().."\r\n"
tmp = tmp.."\t??? REGs Online: "..CountRegs().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? To see the NEWEST additions, type  !tag \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules.  Read them!! \r\n"
tmp = tmp.."\t??? Be sure to READ EVERYTHING in the Main chat window!! \r\n"
tmp = tmp.."\t??? If you like this hub, don't forget to add it to your favorites by typing /fav in mainchat \r\n"
 
user:SendData(sBotName,tmp)
end


--function NewUserConnected(user)
-- local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
-- usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

function NewUserConnected(user)
i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)$")
-- this if routine is checking so if the share cannot be extracted , shre equals to zero. and
-- prevents nil / 1024 * 1024 * 1024 (which are causing the error)
if share == nil then
share = 0
end
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))  

local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: retreat.redirectme.net\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Users Online: "..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..CountMASTERs().."\r\n"
tmp = tmp.."\t??? Operators Online: "..CountOPs().."\r\n"
tmp = tmp.."\t??? VIPs Online: "..CountVIPs().."\r\n"
tmp = tmp.."\t??? REGs Online: "..CountRegs().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? To see the NEWEST additions, type  !tag \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules.  Read them!! \r\n"
tmp = tmp.."\t??? Be sure to READ EVERYTHING in the Main chat window!! \r\n"
tmp = tmp.."\t??? If you like this hub, don't forget to add it to your favorites by typing /fav in mainchat \r\n"
 
user:SendData(sBotName,tmp)
end


Thank you in advance!!
Title:
Post by: pHaTTy on 18 October, 2003, 20:28:36
like this



sBotName = "Information"

frmHub:RegBot(sBotName)

 

function CountMASTERs()
local tmp, online = GetUsersByProfile(GetProfileName(0)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end

function CountOPs()
local tmp, online = GetUsersByProfile(GetProfileName(1)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end


function CountVIPs()
local tmp, online = GetUsersByProfile(GetProfileName(2)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end

function CountRegs()
local tmp, online = GetUsersByProfile(GetProfileName(3)), {n=0}
if tmp then for id = 0, getn(tmp) do if GetItemByName(tmp[id]) then tinsert(online, tmp[id]) end end
end return online.n
end

function OpConnected(user)
local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: retreat.redirectme.net\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Users Online: "..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..CountMASTERs().."\r\n"
tmp = tmp.."\t??? Operators Online: "..CountOPs().."\r\n"
tmp = tmp.."\t??? VIPs Online: "..CountVIPs().."\r\n"
tmp = tmp.."\t??? REGs Online: "..CountRegs().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? To see the NEWEST additions, type  !tag \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules.  Read them!! \r\n"
tmp = tmp.."\t??? Be sure to READ EVERYTHING in the Main chat window!! \r\n"
tmp = tmp.."\t??? If you like this hub, don't forget to add it to your favorites by typing /fav in mainchat \r\n"
 
user:SendPM(sBotName,tmp)
end


--function NewUserConnected(user)
-- local i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)%$$")
-- usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))

function NewUserConnected(user)
i,j,share = strfind(user.sMyInfoString, ".+%$(%d+)$")
-- this if routine is checking so if the share cannot be extracted , shre equals to zero. and
-- prevents nil / 1024 * 1024 * 1024 (which are causing the error)
if share == nil then
share = 0
end
usershare = format("%0.2f", tonumber(share)/(1024*1024*1024))  

local tmp
tmp = "Welcome to "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Your Nick: "..user.sName.."\r\n"
tmp = tmp.."\t??? Your IP: "..user.sIP.."\r\n"
tmp = tmp.."\t??? Your share: "..usershare.."GB\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Hub Name: "..frmHub:GetHubName().."\r\n"
tmp = tmp.."\t??? Hub Address: retreat.redirectme.net\r\n"
tmp = tmp.."\t??? Hub Desc: "..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Users Online: "..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? Masters Online: "..CountMASTERs().."\r\n"
tmp = tmp.."\t??? Operators Online: "..CountOPs().."\r\n"
tmp = tmp.."\t??? VIPs Online: "..CountVIPs().."\r\n"
tmp = tmp.."\t??? REGs Online: "..CountRegs().."\r\n"
tmp = tmp.."\ \r\n"
tmp = tmp.."\t??? To see the NEWEST additions, type  !tag \r\n"
tmp = tmp.."\t??? The Hub Cmd's >>> type !help and !rules.  Read them!! \r\n"
tmp = tmp.."\t??? Be sure to READ EVERYTHING in the Main chat window!! \r\n"
tmp = tmp.."\t??? If you like this hub, don't forget to add it to your favorites by typing /fav in mainchat \r\n"
 
user:SendPM(sBotName,tmp)
end



l8rr,,

-phatty
Title:
Post by: No0bie on 18 October, 2003, 20:35:25
user:SendPM(sBotName,tmp)
I feel like an idiot but trying to learn..
Title:
Post by: pHaTTy on 18 October, 2003, 20:40:36
dont worry about it, when i was first learning i hadnt the slightest idea ;)


-phatty