PtokaX forum

Archive => Archived 5.1 boards => Request for scripts => Topic started by: Chucky on 15 January, 2007, 11:51:15

Title: [REQ] Send status message to a defined profile
Post by: Chucky on 15 January, 2007, 11:51:15
Greetings yall  8)

I've been searching by several days for some instructions on what to do on this case, and found nothing about it!

Let me explain my situation:

I own a Hub were all users get "the key" on their nick, by getting regged...
What i would like to change is the Hub messages such as kick, ban, hublist pinger, myinfo flooder,etc ,etc to be shown only to a certain defined profile...
I know i have to disable on Ptokax\Options so that regged users dont received the message...

I tried to ask about it and i got this example, but had not understood what "for id,who in pairs" do...
<Chucky> hey..   is there allready any script that does something similiar to this ?
<Chucky> or an example function....to get the ideia of what to do  ^.^
<Chucky> hmm...  there's must existing already a script with message's, for hublist pinger's, for example
<Chucky> *searching on it*
<Some1> Chucky... something like this -->

sProfile = 0 -- profile that gets message
message = "blabla" -- message

for id,who in pairs(frmHub:GetOnlineUsers(sProfile)) do
who:SendData(frmHub:GetHubBotName(),message)
end


Maybe i have here the solution to Hublist and havent notice...But what about the other stuff ?

Any Help woud be apreciated ....   Thankx in advanced  ;D
Title: Re: [REQ] Send status message to a defined profile
Post by: Cêñoßy†ê on 15 January, 2007, 15:46:29
heres small example with pinger


Show = { -- What profile receives message   1=yes 0 =no
[-1] = 0, -- unregistered user
[0] = 1, -- master (leviathan/robocop)
[1] = 1, -- operator (leviathan/robocop)
[2] = 0, -- vip (leviathan/robocop)
[3] = 0, -- reg (leviathan/robocop)
[4] = 1, -- moderator (leviathan/robocop)
[5] = 1, -- netfounder (leviathan/robocop)
[6] = 1, -- owner (leviathan)
}

BotINFOArrival = function(user,data) -- pinger detection
        -- Find all online users
for id,who in pairs(frmHub:GetOnlineUsers()) do
        -- check what profile can get message
if Show[who.iProfile] == 1 then
-- Send the message
who:SendData(frmHub:GetHubBotName(),"Pinger "..(user.sName or "n/a").." from IP: "..(user.sIP or "n/a").." detected")
end
end
end
Title: Re: [REQ] Send status message to a defined profile
Post by: Chucky on 16 January, 2007, 10:53:27
Thanks a lot, one more time C??o?y??...

Sorry for hiding your nick on my "code", i just didnt knew if you had any problem about it...

That looks great and solves my hublist pinger problem...But what about the rest of the messages? (status, kick,etc)

I guess i might use the same script (?) and just should change the function "BotINFOArrival" to something else...

I'm i right ?   what function should i use ? 

Thanks and keep up with the good work ;)
Title: Re: [REQ] Send status message to a defined profile
Post by: Chucky on 16 January, 2007, 13:10:11
Well....allready solved the kick messages problem... Just missing the status messages  :-\
Title: Re: [REQ] Send status message to a defined profile
Post by: Chucky on 20 January, 2007, 11:25:17
Well...  i have tryed to do some changes on C??o?y?? script, but looks like it's not working....

Can someone please tell me were am i mistaken ?

--Hublist Pinger detection by C??o?y??
--Hublist Pinger identification added by Chucky


Show = { -- What profile receives message   1=yes 0 =no
[0] = 1, -- master (leviathan/robocop)
[1] = 0, -- operator (leviathan/robocop)
[2] = 0, -- vip (leviathan/robocop)
[3] = 0, -- reg (leviathan/robocop)
[4] = 0, -- moderator (leviathan/robocop)
[5] = 0, -- netfounder (leviathan/robocop)
[6] = 0, -- owner (leviathan)
[-1] = 0, -- unregistered user
}

BotINFOArrival = function(user,data) -- pinger detection
        -- Find all online users
for id,who in pairs(frmHub:GetOnlineUsers()) do
--identify the pinger
if (user.sName == dchublist) then
SendToAll(frmHub:GetHubBotName(),"O Pinger dchublist entrou no hub !\r\n Ajuda o Hub, votando em http://www.dchublist.com/index.php?page=show&id=6718\r\n")
else
        -- check what profile can get message
if Show[who.iProfile] == 1 then
who:SendData(frmHub:GetHubBotName(),"Pinger "..(user.sName or "n/a").." from IP: "..(user.sIP or "n/a").." detected")
end
end
end
end


Is it possible to do this ?  :-\
Title: Re: [REQ] Send status message to a defined profile
Post by: zero-cool on 20 January, 2007, 13:51:40
Hi,

Replace
if (user.sName == dchublist) then
To
if (user.sName == "dchublist") then

But the best way would be to create a table with HubPingers name. ;)


Regards,
Title: Re: [REQ] Send status message to a defined profile
Post by: Chucky on 20 January, 2007, 14:50:18
True...  But i only know this hublist with vote option....
You know any other where users can vote ?

Btw...  The script is sendind the message, allright...   But it sended kind a 100 times or more on mainchat to everyone...

I've tried end's....return1....something is missing   ???