determinate determinate

Author Topic: HideMe 1.0 LUA 5.1x [Strict] [API 2]  (Read 2015 times)

0 Members and 1 Guest are viewing this topic.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
HideMe 1.0 LUA 5.1x [Strict] [API 2]
« on: April 30, 2008, 03:42:38 am »
Code: [Select]
--[[

HideMe 1.0 LUA 5.1x [Strict] [API 2]

By Mutor 04/29/08

Yet another hide script for operators, allows ops
to remove/restore themselves from/to the user list.

- Command permission for operators only
- Provides context menu command to hide/reveal nick
- Option to hide from all users or only non operators
- Hidden users data saved to file for hub/script restarts

]]
-- Preset your hidden nicks here or use user commands after script start
Hidden = {"Mutor","YourNick"}
-- Hide from all users? true/false [false = Hide from non ops, ops may always list hidden users]
local HideFromAll = true
--


local Scp = "HideMe 1.0"
local file = "Hidden.dat"
local Tmr = 0
OnStartup = function() if loadfile(file) then dofile(file) else Save(Hidden) end Hide() end

UserConnected = function(user) Hide(user) end
RegConnected = UserConnected

OpConnected = function(user)
local uc = "$UserCommand 1 3 "..SetMan.GetString(0).."\\"..Scp.."\\"..
"Hide/Reveal Yourself$<%[mynick]> "..SetMan.GetString(29):sub(1,1).."hide&#124;|"
uc = uc..uc:gsub("Hide/Reveal Yourself","List Hidden Operators"):gsub("hide","listhidden")
Core.SendToUser(user,uc)
end

MyINFOArrival = function(user,data) if Check(user.sNick:lower()) and Tmr == 0 then Tmr = TmrMan.AddTimer(750) end end

OnTimer = function(Id) if Id == Tmr then TmrMan.RemoveTimer(Tmr) Tmr = 0 Hide() end end

ChatArrival = function(user,data)
if Core.GetUserValue(user,11) then
local _,_,cmd = data:lower():find("%b<> ["..SetMan.GetString(29).."](%a+)|")
local _,_,to = string.find(data,"^$To: (%S+) From:")
if cmd then
local msg,bot,bool = "",SetMan.GetString(21),false
cmd = cmd:lower()
if cmd == "hide" then
msg,bool = "hidden",true
local ret = Check(user.sNick:lower())
if ret then
table.remove(Hidden,ret) msg = "revealed" Hide(nil,user.sNick)
else
table.insert(Hidden,user.sNick) Hide()
end
Save(Hidden)
msg = "The nick: "..user.sNick.." is now "..msg..".|"
elseif cmd == "listhidden" then
msg,bool = "There are no hidden users at this time.",true
if next(Hidden) then
msg = "\n\n\tListing ["..tostring(#Hidden).."] Hidden Users\n\n\t"
msg = msg..table.concat(Hidden,"\n\t").."\n\n"
end
end
if bool and msg:len() > 0 then
if to then Core.SendPmToUser(user,bot,msg) else Core.SendToUser(user,"<"..bot.."> "..msg) end
return true
end
end
end
end
ToArrival = ChatArrival

Check = function(nick)
for i,v in ipairs(Hidden) do if nick == v:lower() then return i end end
end

Hide = function(user,op)
if op then local usr = Core.GetUser(op) if usr then return Core.SendToAll(Core.GetUserValue(usr,1).."|") end end
for i,v in ipairs(Hidden) do
local msg = "$Quit "..v.."|"
if user then
Core.SendToUser(user,msg)
else
if HideFromAll then
Core.SendToAll(msg)
else
Core.SendToProfile(-1,msg)
for i,v in ipairs(ProfMan.GetProfiles()) do
if not ProfMan.GetProfile(i-1).tProfilePermissions.bIsOP then
Core.SendToProfile(i-1,msg)
end
end
end
end
end
end

Save = function(tab)
local f,e = io.open(file,"wb")
if f then
local s = ""
if next(tab) then
for i,v in pairs(tab) do s = s..string.format("%q",v).."," end
s = "{"..s:sub(1,-2).."}"
else
s = "{}"
end
if s:len() > 0 then f:write("Hidden = "..s) end
f:flush() f:close()
end
end
« Last Edit: April 30, 2008, 06:18:26 am by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline rolipoli

  • Member
  • ***
  • Posts: 34
  • Karma: +0/-1
  • Transilvania-Erdély
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #1 on: April 30, 2008, 08:21:02 pm »
The context menu didn't appear,instead appear this in main,when connect to the hub: $UserCommand 1 3 TESZT\HideMe 1.0\Hide/Reveal Yourself$<%[mynick]> !hide&#124;|$UserCommand 1 3 TESZT\HideMe 1.0\List Hidden Operators$<%[mynick]> !listhidden&#124;|.
Tested whith BCDC++ and Zion++

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #2 on: April 30, 2008, 11:26:50 pm »
There is no problem with the user commands in BCDC 0.699d nor
will there be in any client that properly handles user commands.
Again it sounds like the pipe character issue. Post at the client
developers site and let's stop repeating the same issues with
non protocol compliant clients here. I will not ever write a work-
around for a lack of proper client protocol support.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline rolipoli

  • Member
  • ***
  • Posts: 34
  • Karma: +0/-1
  • Transilvania-Erdély
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #3 on: May 08, 2008, 08:35:44 am »
There is no problem with the user commands in BCDC 0.699d nor
will there be in any client that properly handles user commands.
Again it sounds like the pipe character issue. Post at the client
developers site and let's stop repeating the same issues with
non protocol compliant clients here. I will not ever write a work-
around for a lack of proper client protocol support.
Problem fixed.Now is working perfectly. :)

Offline roblov

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #4 on: July 24, 2008, 12:50:08 am »
Hi,

i don't know lua programming so bear with me if i say something which is wrong or make a question which has been made before.

The script works well for me (i'm using CzDC 0.699 and Ptokax 0.4.1.1) except for the fact that, when i reveal myself, i show as a regular user instead of an op.

can anyone help me to solve this issue?

thanks,

roblov.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
HideMe 1.0b LUA 5.1x [Strict] [API 2]
« Reply #5 on: July 24, 2008, 02:24:55 am »
Try this version:
Code: [Select]
--[[

HideMe 1.0b LUA 5.1x [Strict] [API 2]

By Mutor 04/29/08

Yet another hide script for operators, allows ops
to remove/restore themselves from/to the user list.

- Command permission for operators only
- Provides context menu command to hide/reveal nick
- Option to hide from all users or only non operators
- Hidden users data saved to File for hub/script restarts

+Changes from 1.0 05/23/08
+Added method to reveal nick as operator. Requested by roblov
+Added resend interval setting variable
]]
-- Preset your hidden nicks here or use user commands after script start
Hidden = {"Mutor","YourNick"}
-- Hide from all users? true/false [false = Hide from non ops, ops may always list hidden users]
local HideFromAll = true
-- Interval in ms, where MyINFO will be resent
Int = 750
--


local Scp,File,Tmr = "HideMe 1.0b","Hidden.dat",0
OnStartup = function() if loadfile(File) then dofile(File) else Save(Hidden) end Hide() Int = math.max(Int,250) end

OnExit = function() Restore() end

UserConnected = function(user) Hide(user) end
RegConnected = UserConnected

OpConnected = function(user)
local uc = "$UserCommand 1 3 "..SetMan.GetString(0).."\\"..Scp.."\\"..
"Hide/Reveal Yourself$<%[mynick]> "..SetMan.GetString(29):sub(1,1).."hide&#124;|"
uc = uc..uc:gsub("Hide/Reveal Yourself","List Hidden Operators"):gsub("hide","listhidden")
Core.SendToUser(user,uc)
Hide(user)
end

MyINFOArrival = function(user,data) if Check(user.sNick:lower()) and Tmr == 0 then Tmr = TmrMan.AddTimer(750) end end

OnTimer = function(Id) if Id == Tmr then TmrMan.RemoveTimer(Tmr) Tmr = 0 Hide() end end

ChatArrival = function(user,data)
if Core.GetUserValue(user,11) then
local _,_,cmd = data:lower():find("%b<> ["..SetMan.GetString(29).."](%a+)|")
local _,_,to = data:find("^$To: (%S+) From:")
if cmd then
local msg,bot,bool = "",SetMan.GetString(21),false
cmd = cmd:lower()
if cmd == "hide" then
msg,bool = "hidden",true
local ret = Check(user.sNick:lower())
if ret then
table.remove(Hidden,ret) msg = "revealed" Hide(nil,user.sNick) Restore(user.sNick)
else
table.insert(Hidden,user.sNick) Hide()
end
Save(Hidden)
msg = "The nick: "..user.sNick.." is now "..msg..".|"
elseif cmd == "listhidden" then
msg,bool = "There are no hidden users at this time.",true
if next(Hidden) then
msg = "\n\n\tListing [ "..tostring(#Hidden).." ] Hidden Users\n\n\t"
msg = msg..table.concat(Hidden,"\n\t").."\n\n"
end
end
if bool and msg:len() > 0 then
if to then Core.SendPmToUser(user,bot,msg) else Core.SendToUser(user,"<"..bot.."> "..msg) end
return bool
end
end
end
end
ToArrival = ChatArrival

Check = function(nick) for i,v in ipairs(Hidden) do if nick == v:lower() then return i end end return false end

Hide = function(user,op)
if op then local usr = Core.GetUser(op) if usr then return Core.SendToAll(Core.GetUserValue(usr,1).."|") end end
for i,v in ipairs(Hidden) do
local msg = "$Quit "..v.."|"
if user then
Core.SendToUser(user,msg)
else
if HideFromAll then
Core.SendToAll(msg)
else
Core.SendToProfile(-1,msg)
for i,v in ipairs(ProfMan.GetProfiles()) do
if not ProfMan.GetProfile(i-1).tProfilePermissions.bIsOP then
Core.SendToProfile(i-1,msg)
end
end
end
end
end
end

Restore = function(arg)
local o,t = "$OpList ",{}
for _,user in ipairs(Core.GetOnlineOps()) do
u,ul = user.sNick,user.sNick:lower()
if arg then if not Check(ul) then table.insert(t,u) end else table.insert(t,u) end
end
if next(t) then o = o..table.concat(t,"$$").."$$" end
Core.SendToAll(o.."|")
end

Save = function(tab)
local f,e = io.open(File,"wb")
if f then
local s = ""
if next(tab) then
for i,v in pairs(tab) do s = s..string.format("%q",v).."," end
s = "{"..s:sub(1,-2).."}"
else
s = "{}"
end
if s:len() > 0 then f:write("Hidden = "..s) end
f:flush() f:close()
end
end
« Last Edit: October 04, 2008, 12:31:03 am by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline roblov

  • Newbie
  • *
  • Posts: 4
  • Karma: +1/-0
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #6 on: July 24, 2008, 11:59:56 am »
Hi Mutor,

works well now. Thank you very much for fixing the script.

roblov.

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #7 on: July 24, 2008, 09:53:48 pm »
Your welcome.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline WitchHunter

  • Junior Member
  • **
  • Posts: 21
  • Karma: +0/-0
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #8 on: October 03, 2008, 07:47:06 pm »
Hi Mutor :)

A funny thing occured when using this script. We were two users hiding our selves, but when one of us got revealed the other user appeared as well? I guess that is not what is meant to happen?

regards / WitchHunter

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #9 on: October 04, 2008, 12:31:37 am »
Thanks for the report.
Script above [1.0b] updated.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline WitchHunter

  • Junior Member
  • **
  • Posts: 21
  • Karma: +0/-0
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #10 on: October 04, 2008, 09:34:46 pm »
Working perfect now. Thanx a million  ;D

Offline reaper

  • Member
  • ***
  • Posts: 27
  • Karma: +2/-2
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #11 on: November 16, 2008, 02:13:25 pm »
HI!
This work nice :)
but plz what is the command so I can se my self ???
I cant finde that

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #12 on: November 16, 2008, 02:21:28 pm »
The command is !hide it's a 'toggle'
Use this to enable/disable hiding yourself.
Use !listhidden to list hidden users.
« Last Edit: November 16, 2008, 02:41:06 pm by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline reaper

  • Member
  • ***
  • Posts: 27
  • Karma: +2/-2
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #13 on: November 16, 2008, 02:32:37 pm »
Sorry that dont work for me I try !enable my  I dont nowe howeto do that  :'(

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #14 on: November 16, 2008, 02:40:29 pm »
You need to listen a bit better.
The command is !hide
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline reaper

  • Member
  • ***
  • Posts: 27
  • Karma: +2/-2
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #15 on: November 16, 2008, 04:05:35 pm »
Yes but howecan I send command so I can se my self ?
I have try

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #16 on: November 16, 2008, 04:17:16 pm »
The command !hide hides you if revealed or reveals you if hidden.
This will be the last time I repeat myself, so I hope you get it now.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline reaper

  • Member
  • ***
  • Posts: 27
  • Karma: +2/-2
Re: HideMe 1.0 LUA 5.1x [Strict] [API 2]
« Reply #17 on: November 16, 2008, 04:27:21 pm »
thx for all your help :)

 

determinate determinate
guestbook