PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: Psycho_Chihuahua on 28 September, 2004, 00:22:15

Title: why doesnt this send as PM when set?
Post by: Psycho_Chihuahua on 28 September, 2004, 00:22:15
Hi there, i got this Hub AD Timer script from Mutor (i think)....

well i did some adjustment as you see and i've been trying to get it to be able to send the tmp data as a PM as well instead of just in mainchat...

well it sends a privat message to nick atm but in mainchat.... what did i muck up here?

function OnTimer()
local tmp
tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n" -- add/remove tabs ' \t '  ...to center hub name
tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n"
tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n"
tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\tUmleite Nach: \t"..frmHub:GetRedirectAddress().."\r\n"
tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n"
tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n"
tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n"
tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n"
tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n"
tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tInfo(s):\r\n"
tmp = tmp.."\t-- "..HubMsg1.."\r\n"
tmp = tmp.."\t-- "..HubMsg2.."\r\n"
tmp = tmp.."\t-- "..HubMsg3.."\r\n"
tmp = tmp.."\t-- "..HubMsg4.."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
if SendToMain==0 then
SendPmToAll(bot,tmp) else
SendToAll(bot,tmp)
end
end
Title:
Post by: bastya_elvtars on 28 September, 2004, 00:33:51
Do not forget 2 reister the bot for real PM:

function Main()
frmHub:RegBot(bot)
end
Title:
Post by: Psycho_Chihuahua on 28 September, 2004, 00:35:17
QuoteOriginally posted by bastya_elvtars
Do not forget 2 reister the bot for real PM:

function Main()
frmHub:RegBot(bot)
end

Duh'

Oh Shit ur right  :D  thnx Bastya didnt even think o that

**Edit**

still sends the PM in Main

Script
--AdTimer 1.0
--
--by Mutor
--
--Yet another Hub Advert script
--Sends hub Advert on timer or by command
--
--
assert(dofile("Werbung/Settings.cfg"),"settings file error")

function Main()
frmHub:RegBot(bot)
end

function Main()
SetTimer(mins*60000)
StartTimer()
end

function DataArrival(user, data)
s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
if (cmd==Prefix..AdComm) and user.bOperator then
OnTimer()  
end
end




function OnTimer()
local tmp
tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"  
tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n" -- add/remove tabs ' \t '  ...to center hub name
tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n"
tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n"
tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n"
tmp = tmp.."\tUmleite Nach: \t"..frmHub:GetRedirectAddress().."\r\n"
tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"  
tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n"
tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n"
tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n"
tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n"
tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n"
tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
tmp = tmp.."\tInfo(s):\r\n"
tmp = tmp.."\t-- "..HubMsg1.."\r\n"
tmp = tmp.."\t-- "..HubMsg2.."\r\n"
tmp = tmp.."\t-- "..HubMsg3.."\r\n"
tmp = tmp.."\t-- "..HubMsg4.."\r\n"
tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
if SendToMain==0 then
SendPmToAll(bot,tmp) else
SendToAll(bot,tmp)
end
end

function RedirAll()
rdstatusall = frmHub:GetRedirectAll()
rastatus = ""
if rdstatusall == 1 then
rastatus = "on"
else
rastatus = "off"
end
return rastatus
end

function RedirFull()
rdstatusfull = frmHub:GetRedirectFull()
--local tmp, rdstatusfull = frmHub:GetRedirectFull(),0;
rfstatus = ""
if rdstatusfull == 1 then
rfstatus = "on"
else
rfstatus = "off"
end
return rfstatus
end

function CountMaster()
local tmp, count = GetUsersByProfile(GetProfileName(0)), 0;
if tmp then
for id = 0, getn(tmp) do
if GetItemByName(tmp[id]) then
count = count + 1;
end
end
end
return count
end

function CountOPs()
local tmp, count = GetUsersByProfile(GetProfileName(1)), 0;
if tmp then
for id = 0, getn(tmp) do
if GetItemByName(tmp[id]) then
count = count + 1;
end
end
end
return count
end
function CountVIPs()
local tmp, count = GetUsersByProfile(GetProfileName(2)), 0;
if tmp then
for id = 0, getn(tmp) do
if GetItemByName(tmp[id]) then
count = count + 1;
end
end
end
return count
end
function CountRegUsers()
local tmp, count = GetUsersByProfile(GetProfileName(3)), 0;
if tmp then
for id = 0, getn(tmp) do
if GetItemByName(tmp[id]) then
count = count + 1;
end
end
end
return count
end

and settings
--User Settings-------------------------------------------------------------------------------------
bot = "HubInfo" -- Name des bots
mins = 180 -- Interval [in minuten] zwischen Ads
Hubaddy = "helvetia.ath.cx" -- Doh?
HubOwner = "Johnnie" -- Doh?
Prefix = "+" -- Prefix f?r den Befehl
AdComm = "werbung" -- Befehl um Ad direkt zu senden
TZone = " +1 GMT [EST]" -- Zeit Zone des hubs
SendToMain = 0 --Im Main senden [wenn 0 dann als PM]
HubMsg1 = "Hilfe rund um DC++ und Hubsoft gibts in diesen Foren" -- Helft mit die Foren zu unterst?tzen
HubMsg2 = "Auf Deutsch --> [URL]http://www.dc-stammtisch.de[/URL]" -- Helft mit - anderen zu Helfen
HubMsg3 = "Auf Englisch --> [URL]http://board.univ-angers.fr[/URL]" -- Helft mit die Foren zu unterst?tzen
HubMsg4 = "Auf Englisch --> [URL]http://lua.uknnet.com/[/URL]" -- Helft mit - anderen zu Helfen
--End User Settings----------------------------------------------------------------------------------

I dont know what could be wrong
Title:
Post by: bastya_elvtars on 28 September, 2004, 00:56:16
   --AdTimer 1.0
    --
    --by Mutor
    --
    --Yet another Hub Advert script
    --Sends hub Advert on timer or by command
    --
    --
    assert(dofile("Werbung/Settings.cfg"),"settings file error")



    function Main()
    frmHub:RegBot(bot)
    SetTimer(mins*60000)
    StartTimer()
    end

    function DataArrival(user, data)
    s,e,cmd = strfind(data, "%b<>%s+(%S+)(%S+)")
    if (cmd==Prefix..AdComm) and user.bOperator then
    OnTimer()
    end
    end




    function OnTimer()
    local tmp
    tmp = "\r\n\r\n\t---<>-------------------------------------------------------------------------------------<>---\r\n"
    tmp = tmp.."\t\t[ "..frmHub:GetHubName().." ]\r\n"
    tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
    tmp = tmp.."\tHub Name: \t"..frmHub:GetHubName().."\r\n" -- add/remove tabs ' \t ' ...to center hub name
    tmp = tmp.."\tHub Owner: \t"..HubOwner.."\r\n"
    tmp = tmp.."\tHub Addy: \t"..Hubaddy.."\r\n"
    tmp = tmp.."\tHub Zeit: \t( "..date("%H:%M").." ) -- "..TZone .."\r\n"
    tmp = tmp.."\tHub Desc: \t"..frmHub:GetHubDescr().."\r\n"
    tmp = tmp.."\tUmleite Nach: \t"..frmHub:GetRedirectAddress().."\r\n"
    tmp = tmp.."\tReg Server: \t"..frmHub:GetRegServer().."\r\n"
    tmp = tmp.."\tRedirect Alle: \t"..RedirAll().."\r\n"
    tmp = tmp.."\tRedirect Voll: \t"..RedirFull().."\r\n"
    tmp = tmp.."\tMax Users: \t"..frmHub:GetMaxUsers().."\r\n"
    tmp = tmp.."\tMin Share: \t"..frmHub:GetMinShare().."\r\n"
    tmp = tmp.."\tHub Share: \t"..frmHub:GetCurrentShareAmount().."\r\n"
    tmp = tmp.."\tMasters Online: \t\t"..CountMaster().."\r\n"
    tmp = tmp.."\tOps Online: \t\t"..CountOPs().."\r\n"
    tmp = tmp.."\tVips Online: \t\t"..CountVIPs().."\r\n"
    tmp = tmp.."\tRegs Online: \t\t"..CountRegUsers().."\r\n"
    tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
    tmp = tmp.."\tTotal Online: \t\t"..frmHub:GetUsersCount().."\r\n"
    tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
    tmp = tmp.."\tInfo(s):\r\n"
    tmp = tmp.."\t-- "..HubMsg1.."\r\n"
    tmp = tmp.."\t-- "..HubMsg2.."\r\n"
    tmp = tmp.."\t-- "..HubMsg3.."\r\n"
    tmp = tmp.."\t-- "..HubMsg4.."\r\n"
    tmp = tmp.."\t---<>-------------------------------------------------------------------------------------<>---\r\n"
    if SendToMain==0 then
SendPmToAll(bot,tmp)
    else
SendToAll(bot,tmp)
    end
end

    function RedirAll()
    rdstatusall = frmHub:GetRedirectAll()
    rastatus = ""
    if rdstatusall == 1 then
    rastatus = "on"
    else
    rastatus = "off"
    end
    return rastatus
    end

    function RedirFull()
    rdstatusfull = frmHub:GetRedirectFull()
    --local tmp, rdstatusfull = frmHub:GetRedirectFull(),0;
    rfstatus = ""
    if rdstatusfull == 1 then
    rfstatus = "on"
    else
    rfstatus = "off"
    end
    return rfstatus
    end

    function CountMaster()
    local tmp, count = GetUsersByProfile(GetProfileName(0)), 0;
    if tmp then
    for id = 0, getn(tmp) do
    if GetItemByName(tmp[id]) then
    count = count + 1;
    end
    end
    end
    return count
    end

    function CountOPs()
    local tmp, count = GetUsersByProfile(GetProfileName(1)), 0;
    if tmp then
    for id = 0, getn(tmp) do
    if GetItemByName(tmp[id]) then
    count = count + 1;
    end
    end
    end
    return count
    end
    function CountVIPs()
    local tmp, count = GetUsersByProfile(GetProfileName(2)), 0;
    if tmp then
    for id = 0, getn(tmp) do
    if GetItemByName(tmp[id]) then
    count = count + 1;
    end
    end
    end
    return count
    end
    function CountRegUsers()
    local tmp, count = GetUsersByProfile(GetProfileName(3)), 0;
    if tmp then
    for id = 0, getn(tmp) do
    if GetItemByName(tmp[id]) then
    count = count + 1;
    end
    end
    end
    return count
    end



and settings

code:

    --User Settings-------------------------------------------------------------------------------------
    bot = "HubInfo" -- Name des bots
    mins = 180 -- Interval [in minuten] zwischen Ads
    Hubaddy = "helvetia.ath.cx" -- Doh?
    HubOwner = "Johnnie" -- Doh?
    Prefix = "+" -- Prefix f?r den Befehl
    AdComm = "werbung" -- Befehl um Ad direkt zu senden
    TZone = " +1 GMT [EST]" -- Zeit Zone des hubs
    SendToMain = 0 --Im Main senden [wenn 0 dann als PM]
    HubMsg1 = "Hilfe rund um DC++ und Hubsoft gibts in diesen Foren" -- Helft mit die Foren zu unterst?tzen
    HubMsg2 = "Auf Deutsch --> [URL]http://www.dc-stammtisch.de[/URL]" -- Helft mit - anderen zu Helfen
    HubMsg3 = "Auf Englisch --> [URL]http://board.univ-angers.fr[/URL]" -- Helft mit die Foren zu unterst?tzen
    HubMsg4 = "Auf Englisch --> [URL]http://lua.uknnet.com/[/URL]" -- Helft mit - anderen zu Helfen
    --End User Settings----------------------------------------------------------------------------------
Title:
Post by: Psycho_Chihuahua on 28 September, 2004, 01:06:30
Thnx a lot M8

that was a real quick answer  :D