hmm can someone convert this to lua 5.1 ?
--//-- Hider by C??o?y??--//--
-- added hide user on reconnect -- By Dessamator
--- touched by Herodes [18/09/2006]
-- - added the autocleaner on user disconnections
-- - added the listhide for showing a list with the ghosts
Bot = frmHub:GetHubBotName()
kMenu = "?~UserHider~?"
tGhosts={}
CanDo = {
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 0, -- Moderator
[5] = 0, -- Netfounder
}
OpConnected = function(user)
if CanDo[user.iProfile] == 1 and user.bUserCommand then
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide from userlist$<%[mynick]> !hide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return to userlist$<%[mynick]> !unhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Show ghosts$<%[mynick]> !listhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide this user from userlist$<%[mynick]> !hide %[nick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return user to userlist$<%[mynick]> !unhide %[line:Nick]|")
end
end
function Main()
SetTimer(1000)
StartTimer()
end
function OnTimer() ---- WHy!?!!?
for i,v in tGhost do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
ChatArrival = function(user, data)
data=string.sub(data,1,-2)
local s, e, cmd, victim = string.find( data, "%b<>%s+[%!](%S+)%s*(%S*)")
local tCmd= {
hide = function( user, victim )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if victim then
victim = GetItemByName(victim)
if not victim then
user:SendData( '*** '..victim..' was not found,.. try again.' );
return 1;
end
tGhosts[user.sName] = 1
SendToAll( '$Quit '..victim.sName )
user:SendData( '*** You have put '..victim.sName..' into Ghost Mode.' )
victim:SendData( '*** '..user.sName..' has put you into Ghost Mode.' )
return 1;
end
tGhosts[user.sName] = 1
user:SendData( '*** You are now in Ghost Mode.' )
SendToAll( '$Quit '..user.sName )
return 1;
end,
unhide = function( user, victim )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if not victim then
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
SendToAll( user.sMyInfoString )
if user.bOperator then SendToAll( '$OpList '..user.sName) end
user:SendData( '*** You are now back from Ghost Mode.' )
return 1;
end
end
victim = GetItemByName(victim)
if tGhosts[victim.sName] then
tGhosts[victim.sName] = nil
SendToAll( victim.sMyInfoString )
if victim.bOperator then SendToAll( '$OpList '..victim.sName) end
victim:SendData( '*** '..user.sName..' has gotten you back from Ghost Mode.' )
user:SendData( '*** You have taken '..victim.sName..' back from Ghost Mode.' )
return 1;
end
end,
listhide = function( user )
local m = '*** List of hidden users\r\n'
for i,v in pairs(tGhosts) do
m = m..'\t'..i..'\r\n'
end
user:SendData( m )
end,
}
if tCmd[cmd] then
return tCmd[cmd](user, victim)
end
end
function UserDisconnected( user )
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
end
end
OpDisconnected = UserDisconnected;
Should work but I haven't tested it at all, sorry no time for that.
--//-- Hider by C??o?y??--//--
-- added hide user on reconnect -- By Dessamator
--- touched by Herodes [18/09/2006]
-- - added the autocleaner on user disconnections
-- - added the listhide for showing a list with the ghosts
Bot = frmHub:GetHubBotName()
kMenu = "?~UserHider~?"
tGhosts={}
CanDo = {
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 0, -- Moderator
[5] = 0, -- Netfounder
}
OpConnected = function(user)
if (CanDo[user.iProfile] == 1 and user.bUserCommand) then
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide from userlist$<%[mynick]> !hide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return to userlist$<%[mynick]> !unhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Show ghosts$<%[mynick]> !listhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide this user from userlist$<%[mynick]> !hide %[nick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return user to userlist$<%[mynick]> !unhide %[line:Nick]|")
end
end
function Main()
SetTimer(1000); StartTimer();
end
function OnTimer() ---- WHy!?!!?
for i,v in pairs(tGhost) do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
ChatArrival = function(user, data)
data=string.sub(data,1,-2)
local cmd, victim = string.match( data, "%b<>%s+[%!](%S+)%s*(%S*)")
local tCmd= {
hide = function( user, victim )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if victim then
victim = GetItemByName(victim)
if not victim then
user:SendData( '*** '..victim..' was not found,.. try again.' );
return 1;
end
tGhosts[user.sName] = 1
SendToAll( '$Quit '..victim.sName )
user:SendData( '*** You have put '..victim.sName..' into Ghost Mode.' )
victim:SendData( '*** '..user.sName..' has put you into Ghost Mode.' )
return 1;
end
tGhosts[user.sName] = 1
user:SendData( '*** You are now in Ghost Mode.' )
SendToAll( '$Quit '..user.sName )
return 1;
end,
unhide = function( user, victim )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if not victim then
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
SendToAll( user.sMyInfoString )
if user.bOperator then SendToAll( '$OpList '..user.sName) end
user:SendData( '*** You are now back from Ghost Mode.' )
return 1;
end
end
victim = GetItemByName(victim)
if tGhosts[victim.sName] then
tGhosts[victim.sName] = nil
SendToAll( victim.sMyInfoString )
if victim.bOperator then SendToAll( '$OpList '..victim.sName) end
victim:SendData( '*** '..user.sName..' has gotten you back from Ghost Mode.' )
user:SendData( '*** You have taken '..victim.sName..' back from Ghost Mode.' )
return 1;
end
end,
listhide = function( user )
local m = '*** List of hidden users\r\n'
for i,v in pairs(tGhosts) do
m = m..'\t'..i..'\r\n'
end
user:SendData( m )
end,
}
if tCmd[cmd] then
return tCmd[cmd](user, victim)
end
end
function UserDisconnected( user )
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
end
end
OpDisconnected = UserDisconnected;
did not work: hide.users.lua:34: bad argument #1 to 'pairs' (table expected, got nil)
Small typo..
Exchange this
function OnTimer() ---- WHy!?!!?
for i,v in pairs(tGhost) do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
with this:
function OnTimer() ---- WHy!?!!?
for i,v in pairs(tGhosts) do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
Thanks,
Snooze
thx but still som probs:
!hide$MyINFO $ALL zvamp - description - <++ V:0.68,M:A,H:0/0/2,S:1>$ $1$n@t$285563543398$ <-- this spams in main and it?s not putting me in ghostmode..
hide.users.lua:54: attempt to concatenate local 'victim' (a nil value) <-- when i?m trying to hide a user
Umm.. did a quick test and this works for me..
--//-- Hider by C??o?y??--//--
-- added hide user on reconnect -- By Dessamator
--- touched by Herodes [18/09/2006]
-- - added the autocleaner on user disconnections
-- - added the listhide for showing a list with the ghosts
Bot = frmHub:GetHubBotName()
kMenu = "?~UserHider~?"
tGhosts={}
CanDo = {
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 0, -- Moderator
[5] = 0, -- Netfounder
}
OpConnected = function(user)
if (CanDo[user.iProfile] == 1 and user.bUserCommand) then
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide from userlist$<%[mynick]> !hideme %[mynick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return to userlist$<%[mynick]> !unhide %[mynick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Show ghosts$<%[mynick]> !listhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide this user from userlist$<%[mynick]> !hide %[nick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return user to userlist$<%[mynick]> !unhide %[line:Nick]|")
end
end
function Main()
SetTimer(1000); StartTimer();
end
function OnTimer() ---- WHy!?!!?
for i,v in pairs(tGhosts) do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
ChatArrival = function(user, data)
data=string.sub(data,1,-2)
local cmd, victim = string.match( data, "%b<>%s+[%!](%S+)%s+(%S+)")
local tCmd= {
hide = function( user, victim )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if victim then
victim = GetItemByName(victim)
if not victim then
user:SendData( "*** "..victim.." was not found,.. try again." );
return 1;
end
tGhosts[user.sName] = 1
SendToAll( '$Quit '..victim.sName )
user:SendData( '*** You have put '..victim.sName..' into Ghost Mode.' )
victim:SendData( '*** '..user.sName..' has put you into Ghost Mode.' )
return 1;
end
end,
hideme = function(user)
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
tGhosts[user.sName] = 1
user:SendData( '*** You are now in Ghost Mode.' )
SendToAll( '$Quit '..user.sName )
return 1;
end,
unhide = function( user, victim )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if not victim then
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
SendToAll( user.sMyInfoString )
if user.bOperator then SendToAll( '$OpList '..user.sName) end
user:SendData( '*** You are now back from Ghost Mode.' )
return 1;
end
end
victim = GetItemByName(victim)
if tGhosts[victim.sName] then
tGhosts[victim.sName] = nil
SendToAll( victim.sMyInfoString )
if victim.bOperator then SendToAll( '$OpList '..victim.sName) end
victim:SendData( '*** '..user.sName..' has gotten you back from Ghost Mode.' )
user:SendData( '*** You have taken '..victim.sName..' back from Ghost Mode.' )
return 1;
end
end,
listhide = function( user )
local m = '*** List of hidden users\r\n'
for i,v in pairs(tGhosts) do
m = m..'\t'..i..'\r\n'
end
user:SendData( m )
end,
}
if tCmd[cmd] then
return tCmd[cmd](user, victim)
end
end
function UserDisconnected( user )
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
end
end
OpDisconnected = UserDisconnected;
thank you!!
Only thing that does not work is when I hide a user I can?t unhide the user back again =(
It just spams mainchat with: !unhide test
and !listhide does not work..
yes, i have the same problem
Ok ok ok ...
--//-- Hider by C??o?y??--//--
-- added hide user on reconnect -- By Dessamator
--- touched by Herodes [18/09/2006]
-- - added the autocleaner on user disconnections
-- - added the listhide for showing a list with the ghosts
Bot = frmHub:GetHubBotName()
kMenu = "?~UserHider~?"
tGhosts={}
CanDo = {
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 0, -- Moderator
[5] = 0, -- Netfounder
}
OpConnected = function(user)
if (CanDo[user.iProfile] == 1 and user.bUserCommand) then
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide from userlist$<%[mynick]> !hide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return to userlist$<%[mynick]> !unhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Show ghosts$<%[mynick]> !listhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide this user from userlist$<%[mynick]> !hide %[nick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return user to userlist$<%[mynick]> !unhide %[line:Nick]|")
end
end
function Main()
SetTimer(1000); StartTimer();
end
function OnTimer() ---- WHy!?!!?
for i,v in pairs(tGhosts) do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
doVictim = function(data)
local cmd, victim = string.match( data, "%b<>%s+[%!](%S+)%s+(%S+)")
return victim
end
ChatArrival = function(user, data)
data=string.sub(data,1,-2)
local cmd = string.match( data, "%b<>%s+[%!](%S+)")
local tCmd= {
hide = function( user, data)
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
doVictim(data)
if victim then
victim = GetItemByName(victim)
if not victim then
user:SendData( "*** "..victim.." was not found,.. try again." );
return 1;
end
tGhosts[user.sName] = 1
SendToAll( '$Quit '..victim.sName )
user:SendData( '*** You have put '..victim.sName..' into Ghost Mode.' )
victim:SendData( '*** '..user.sName..' has put you into Ghost Mode.' )
return 1;
else
tGhosts[user.sName] = 1
user:SendData( '*** You are now in Ghost Mode.' )
SendToAll( '$Quit '..user.sName )
return 1;
end
end,
unhide = function( user, data )
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
doVictim(data)
if not victim then
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
SendToAll( user.sMyInfoString )
if user.bOperator then SendToAll( '$OpList '..user.sName) end
user:SendData( '*** You are now back from Ghost Mode.' )
return 1;
end
end
victim = GetItemByName(victim)
if tGhosts[victim.sName] then
tGhosts[victim.sName] = nil
SendToAll( victim.sMyInfoString )
if victim.bOperator then SendToAll( '$OpList '..victim.sName) end
victim:SendData( '*** '..user.sName..' has gotten you back from Ghost Mode.' )
user:SendData( '*** You have taken '..victim.sName..' back from Ghost Mode.' )
return 1;
end
end,
listhide = function(user)
local m = "*** List of hidden users\r\n"
for sUser in pairs(tGhosts) do
m = m..'\t'..sUser..'\r\n'
end
user:SendData( m )
return 1
end,
}
if tCmd[cmd] then
return tCmd[cmd](user, data)
end
end
function UserDisconnected( user )
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
end
end
OpDisconnected = UserDisconnected;
Have fun hiding <g>
/Snooze
nice work!! thanx!
The funktion to hide a user does not work, when im trying to hide a user the script spams main: *** You are now in Ghost Mode.
It seems that it?s hiding me when it should hide a certain user.. But this function is not something that we will use anyway so CHEEERS & thanx once again ;)
hi snooze,
is there a psooibility that you finish your little script here, there is at least one little thing to correct, like zvamp wrote before.
thank you
regards
ollo
Ok..
--//-- Hider by C??o?y??--//--
-- added hide user on reconnect -- By Dessamator
--- touched by Herodes [18/09/2006]
-- - added the autocleaner on user disconnections
-- - added the listhide for showing a list with the ghosts
-- Rewritten by Snooze 8:39 PM 12/17/2006
Bot = frmHub:GetHubBotName()
kMenu = "?~UserHider~?"
tGhosts={}
CanDo = {
[0] = 1, -- Master
[1] = 0, -- Operator
[4] = 0, -- Moderator
[5] = 0, -- Netfounder
}
OpConnected = function(user)
if (CanDo[user.iProfile] == 1 and user.bUserCommand) then
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide from userlist$<%[mynick]> !hideme|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return to userlist$<%[mynick]> !unhideme|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Show ghosts$<%[mynick]> !listhide|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Hide this user from userlist$<%[mynick]> !hide %[nick]|")
user:SendData("$UserCommand 1 3 "..kMenu.."\\Return user to userlist$<%[mynick]> !unhide %[line:Enter Nick]|")
end
end
function Main()
SetTimer(1000); StartTimer();
end
function OnTimer() ---- WHy!?!!?
for i,v in pairs(tGhosts) do
if GetItemByName(i) then
SendToAll("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
GetItemByName(i):SendData("$Quit "..i)
end
end
end
ChatArrival = function(user, data)
local _,_,cmd = string.find( data, "%b<>%s+!(%S+)(.*)|")
local tCmd= {
hide = function( user, data)
doArg1(data)
if not CanDo[user.iProfile] then user:SendData(Bot, "*** You are not allowed to use this command.")
return 1;
elseif arg then
local sUser = GetItemByName(arg)
if not sUser then
user:SendData( "*** "..sUser.." was not found,.. try again." );
return 1;
else
tGhosts[arg] = 1
SendToAll("$Quit "..sUser.sName )
user:SendData( "*** You have put "..arg.." into Ghost Mode." )
sUser:SendData( "*** "..user.sName.." has put you into Ghost Mode." )
return 1;
end
else
user:SendData("*** Error! - You need to enter a Nick to Ghost!")
return 1
end
end,
hideme = function(user,data)
if not CanDo[user.iProfile] then
user:SendData(Bot, "*** You are not allowed to use this command.")
return 1;
else
tGhosts[user.sName] = 1
user:SendData( "*** You are now in Ghost Mode." )
SendToAll( "$Quit "..user.sName )
return 1;
end
end,
unhide = function( user, data )
if not CanDo[user.iProfile] then user:SendData(Bot, "*** You are not allowed to use this command.")
return 1;
end
doArg1(data)
if arg then
if tGhosts[arg] then
tGhosts[arg] = nil
local sUser = GetItemByName(arg)
SendToAll( sUser.sMyInfoString )
if sUser.bOperator then SendToAll( '$OpList '..sUser.sName) end
sUser:SendData( '*** '..user.sName..' has gotten you back from Ghost Mode.' )
user:SendData( '*** You have taken '..sUser.sName..' back from Ghost Mode.' )
return 1;
else
user:SendData("*** Error! - No user named "..arg.." in Ghost Mode!")
return 1
end
else
user:SendData("*** Error! - You need to enter a Nick to Unhide!")
return 1
end
end,
unhideme = function(user,data)
if not CanDo[user.iProfile] then user:SendData(Bot, "you cant use this command"); return 1; end
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
SendToAll( user.sMyInfoString )
if user.bOperator then SendToAll( "$OpList "..user.sName) end
user:SendData( "*** You are now back from Ghost Mode." )
return 1;
else
user:SendData("*** Error! - You're not in Ghost Mode.")
end
end,
listhide = function(user)
local m = "*** List of hidden users\r\n"
for sUser in pairs(tGhosts) do
m = m..'\t'..sUser..'\r\n'
end
user:SendData( "\r\n\t"..m )
return 1
end,
}
if tCmd[cmd] then
return tCmd[cmd](user, data)
end
end
function doArg1(data)
s,e,cmd,arg = string.find(data, "%b<>%s+!(%S+)%s+(.+)|" )
return arg
end
function UserDisconnected( user )
if tGhosts[user.sName] then
tGhosts[user.sName] = nil
end
end
OpDisconnected = UserDisconnected;
Though one could argue that Herodes should have done that ;)
Greets,
Snooze
Hello Snoose...
When trying to apply to my Bot the command !hide <Bot>, the script stopped, and appeared this message of error:
[01:30] Sintaxe C:\Ptokax\scripts\Hider.lua:57: attempt to concatenate local 'sUser' (a nil value)
Into main chat... i see: [01:30:28] <7P-Darkman> !hide ?(?`?.?(-?Zagaieiro?-)?.???)?
Obs: ?(?`?.?(-?Zagaieiro?-)?.???)? is my security bot
What I made of wrong?
Respectfully,
7P-Darkman
change
if not sUser then
user:SendData( "*** "..sUser.." was not found,.. try again." );
return 1;
else
with
if not sUser then
user:SendData( "*** "..arg.." was not found,.. try again." );
return 1;
else
Thanks, CrazyGuy... works fine now ! ;)
Respectfully,
7P-Darkman
thx a lot....it works now
Duh.. thanks CG :)
Hello friends...
After to be invisible, when return, me does not appear the key, identifying me as Netfounder (Robocop profile).
What it could be this?
Respectfully,
7P-Darkman
Nothing you can do about it, maybe resending the $OpList to all users it works, just eats all your b/w. This is the punismhment for the protocol rapture. :-P
Quote from: 7P-Darkman on 19 December, 2006, 03:09:56
...
After to be invisible, when return, me does not appear the key, identifying me as Netfounder (Robocop profile).
...
tGhosts[user.sName] = nil
SendToAll( user.sMyInfoString )
if user.bOperator then SendToAll( '$OpList '..user.sName) end
user:SendData( '*** You are now back from Ghost Mode.' )
return 1;
Those ' signs supposed to work like the " signs ??? ??? I didn't seem to notice that :P
I would not be surprised if it has problems with sending $OpList in this case
Quote from: bastya_elvtars on 19 December, 2006, 19:42:11
Nothing you can do about it, maybe resending the $OpList to all users it works, just eats all your b/w. This is the punismhment for the protocol rapture. :-P
Hummm... now I am understanding, Bastya
Quote from: Naithif on 19 December, 2006, 22:17:09
Those ' signs supposed to work like the " signs ??? ??? I didn't seem to notice that :P
I would not be surprised if it has problems with sending $OpList in this case
Yes, Naithif... I was surprised by this notice :(
In Annex, my translation for my language (Brazilian Portiguese)... Case some Owner is interested in using it.
Respectfully,
7P-Darkman
Quote from: bastya_elvtars on 19 December, 2006, 19:42:11
Nothing you can do about it, maybe resending the $OpList to all users it works, just eats all your b/w. This is the punismhment for the protocol rapture. :-P
As a new operator comes online, only $OpList <new op>| is send. It can be easily resend here too:
But it seems the script already does this
if user.bOperator then SendToAll( "$OpList "..user.sName) end
even the order ( MyINFO before OpList ) is correct :-\
And not bOperator but bHasKey IMHO.