PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Request for scripts => Topic started by: kalle370 on 24 April, 2008, 20:14:17

Title: hide user
Post by: kalle370 on 24 April, 2008, 20:14:17
commands:
hideme on/off

Script:
Auto hide whit join: set profile
Show hide me users set profile
hideme set profile

Title: Re: hide user
Post by: [OnLy]-PiTiCu on 25 April, 2008, 19:36:51
Script for HideOp:

script for 0.3.6.0 converted for NewAPI

-- This script is converted with PtokaX LUA API Converter v0.9 at 04/25/08 20:34:45


Bot = SetMan.GetString(21)
kMenu = "HideOp"

tGhosts={}

CanDo = {
[0] = 1, -- Master
[1] = 1, -- Operator
[4] = 1, -- Moderator
[5] = 1, -- Netfounder
}

OpConnected = function(user)
Core.GetUserAllData(user)
if (CanDo[user.iProfile] == 1 and  user.bUserCommand) then
Core.SendToNick(user.sNick,"$UserCommand 1 3 "..kMenu.."\\Hide from userlist$<%[mynick]> !hideme&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 3 "..kMenu.."\\Return to userlist$<%[mynick]> !unhideme&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 3 "..kMenu.."\\Show ghosts$<%[mynick]> !listhide&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 3 "..kMenu.."\\Hide this user from userlist$<%[mynick]> !hide %[nick]&#124;")
Core.SendToNick(user.sNick,"$UserCommand 1 3 "..kMenu.."\\Return user to userlist$<%[mynick]> !unhide %[line:Enter Nick]&#124;")
end
end

function OnStartup()

end

function OnTimer(tmr)  ---- WHy!?!!?
for i,v in pairs(tGhosts) do
if Core.GetUser(i,true) then
Core.SendToAll("$Quit "..i)
Core.Core.SendToNick(i.sNick,"$Quit "..i)
Core.Core.SendToNick(i.sNick,"$Quit "..i)
end
end
end



ChatArrival = function(user,data)
Core.GetUserAllData(user)
local _,_,cmd = string.find( data, "%b<>%s+!(%S+)(.*)|")

local tCmd= {
hide = function( user, data)
doArg1(data)
if not CanDo[user.iProfile] then Core.SendToNick(user.sNick,"<"..Bot.."> *** You are not allowed to use this command.")
return true;
elseif arg then
local sUser = Core.GetUser(arg,true)
if not sUser then
Core.SendToNick(user.sNick, "*** "..sUser.." was not found,.. try again." );
return true;
else
tGhosts[arg] = 1
Core.SendToAll("$Quit "..sUser.sNick )
Core.SendToNick(user.sNick, "*** You have put "..arg.." into Ghost Mode." )
Core.SendToNick(sUser.sNick, "*** "..user.sNick.." has put you into Ghost Mode." )
return true;
end
else
Core.SendToNick(user.sNick,"*** Error! - You need to enter a Nick to Ghost!")
return true
end
end,

hideme = function(user,data)
if not CanDo[user.iProfile] then
Core.SendToNick(user.sNick,"<"..Bot.."> *** You are not allowed to use this command.")
return true;
else
tGhosts[user.sNick] = 1
Core.SendToNick(user.sNick, "*** You are now in Ghost Mode." )
Core.SendToAll( "$Quit "..user.sNick )
return true;
end
end,

unhide = function( user, data )
if not CanDo[user.iProfile] then Core.SendToNick(user.sNick,"<"..Bot.."> *** You are not allowed to use this command.")
return true;
end
doArg1(data)
if arg then
if tGhosts[arg] then
tGhosts[arg] = nil
local sUser = Core.GetUser(arg,true)
Core.SendToAll( sUser.sMyInfoString )
if sUser.bOperator then Core.SendToAll( '$OpList '..sUser.sNick) end
Core.SendToNick(sUser.sNick, '*** '..user.sNick..' has gotten you back from Ghost Mode.' )
Core.SendToNick(user.sNick, '*** You have taken '..sUser.sNick..' back from Ghost Mode.' )
return true;
else
Core.SendToNick(user.sNick,"*** Error! - No user named "..arg.." in Ghost Mode!")
return true
end
else
Core.SendToNick(user.sNick,"*** Error! - You need to enter a Nick to Unhide!")
return true
end
end,

unhideme = function(user,data)
if not CanDo[user.iProfile] then Core.SendToNick(user.sNick,"<"..Bot.."> you cant use this command"); return true; end
if tGhosts[user.sNick] then
tGhosts[user.sNick] = nil
Core.SendToAll( user.sMyInfoString )
if user.bOperator then Core.SendToAll( "$OpList "..user.sNick) end
Core.SendToNick(user.sNick, "*** You are now back from Ghost Mode." )
return true;
else
Core.SendToNick(user.sNick,"*** 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
Core.SendToNick(user.sNick, "\r\n\t"..m )
return true
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)
Core.GetUserAllData(user)
if tGhosts[user.sNick] then
tGhosts[user.sNick] = nil
end
end

OpDisconnected = UserDisconnected; 

RegDisconnected = UserDisconnected



sorry for my bad english.  Script is working
Title: Re: hide user
Post by: Giorgos on 28 April, 2008, 18:19:20
It shows the hidden user/s if you just reconnect and it also sends the !unhideme command to the mainchat when you are not hidden.

Is it supposed to do the former? Fix plz? =)
Title: Re: hide user
Post by: Annie on 25 July, 2008, 13:03:46
I'm using this script and have noticed that when you hide op newly connecting users can see you.  Can it be done so that they cant    thanks  :)