PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Vntalk on 04 August, 2004, 12:29:42

Title: !hideme !unhideme standalone script
Post by: Vntalk on 04 August, 2004, 12:29:42
anyone know that script ?? that command in Channel Bot make the admin of the hub invisible,but i only want the script to do that only not the whole CB. :))
Title:
Post by: Typhoon on 04 August, 2004, 15:04:40
you could try this script by Phatty ...


--Lance Evol v1.00
--Hider Bot, this one does not give the nick taken error ;)
--Written by Phatty 12th December 2k3
--Need to sort the Logged in LogedIn not work neither any ideas?

Bot = "?????R"
Hidden = {}

function NewUserConnected(user)
if Hidden == nil then
return 1
else
for i,v in Hidden do
user:SendData( "$Quit "..i )
end
end
end

function OpConnected(user)
if Hidden == nil then
return 1
else
for i,v in Hidden do
user:SendData( "$Quit "..i )
end
end
end

function DataArrival(user, data)
if(strsub(data, 1, 4) == "$Quit ") then
if Hidden[user.sName] == 1 then
Hidden[user.sName] = nil
end
end

if strsub(data, 1, 1) == "<" then
data=strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data,"%b<>%s+(%S+)")

if cmd == "hide" then
if user.bOperator then
SendToAll( "$Quit "..user.sName )
Hidden[user.sName] = 1
end
elseif cmd == "unhide" then
if user.bOperator then
SendToAll( "$Hello "..user.sName )
Hidden[user.sName] = nil
end
end
end
end



** Typhoon?
Title:
Post by: Psycho_Chihuahua on 04 August, 2004, 17:54:25
i'm using

--Requested by Bladerunneruk
--Made by nErBoS

sBot = "HubBot"

hide = {}
hidesv = "hide.dat"

function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(hidesv)
RefreshHide()
end

function OnExit()
SaveToFile(hidesv , hide , "hide")
end

function OpDisconnect(user, data)
if (user.iProfile == 0) then
hide[user.sName] = nil
frmHub:UnregBot(user.sName)
end
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!hide" and user.iProfile == 0) then
if (hide[user.sName] == nil) then
hide[user.sName] = 1
frmHub:UnregBot(user.sName)
user:SendPM(sBot, "You are now hide from the user list")
else
user:SendPM(sBot, "You are already hide from the user list")
end
return 1
elseif (cmd == "!unhide" and user.iProfile == 0) then
if (hide[user.sName] ~= nil) then
hide[user.sName] = nil
frmHub:RegBot(user.sName)
user:SendPM(sBot, "You are now back to the user list")
else
user:SendPM(sBot, "You are not hide from the Hub")
end
return 1
end
end
if (strsub(data,1,12) == "$GetNickList") then
RefreshHide()
end
if (strsub(data,1,5) == "$To: ") then
local s,e,usr = strfind(data, "$To:%s+(%S+)")
if (hide[usr] ~= nil) then
return 1
end
end
end

function RefreshHide()
local usr,aux
for usr, aux in hide do
frmHub:UnregBot(usr)
end
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
Title:
Post by: QuikThinker on 04 August, 2004, 20:54:12
The script by Nerbos is excellent but I need a mod so OPs can use it 2. At the moment it jus works 4 Masters :s
Title:
Post by: Snooze on 04 August, 2004, 21:04:00
That should do it ..

--Requested by Bladerunneruk
--Made by nErBoS

sBot = "HubBot"

hide = {}
hidesv = "hide.dat"

function Main()
frmHub:RegBot(sBot)
frmHub:EnableFullData(1)
LoadFromFile(hidesv)
RefreshHide()
end

function OnExit()
SaveToFile(hidesv , hide , "hide")
end

function OpDisconnect(user, data)
if (user.iProfile == 0) then
hide[user.sName] = nil
frmHub:UnregBot(user.sName)
end
end

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!hide" and user.iProfile <= 1) then
if (hide[user.sName] == nil) then
hide[user.sName] = 1
frmHub:UnregBot(user.sName)
user:SendPM(sBot, "You are now hide from the user list")
else
user:SendPM(sBot, "You are already hide from the user list")
end
return 1
elseif (cmd == "!unhide" and user.iProfile <= 1) then
if (hide[user.sName] ~= nil) then
hide[user.sName] = nil
frmHub:RegBot(user.sName)
user:SendPM(sBot, "You are now back to the user list")
else
user:SendPM(sBot, "You are not hide from the Hub")
end
return 1
end
end
if (strsub(data,1,12) == "$GetNickList") then
RefreshHide()
end
if (strsub(data,1,5) == "$To: ") then
local s,e,usr = strfind(data, "$To:%s+(%S+)")
if (hide[usr] ~= nil) then
return 1
end
end
end

function RefreshHide()
local usr,aux
for usr, aux in hide do
frmHub:UnregBot(usr)
end
end

function Serialize(tTable, sTableName, sTab)
assert(tTable, "tTable equals nil");
assert(sTableName, "sTableName equals nil");

assert(type(tTable) == "table", "tTable must be a table!");
assert(type(sTableName) == "string", "sTableName must be a string!");

sTab = sTab or "";
sTmp = ""

sTmp = sTmp..sTab..sTableName.." = {\n"

for key, value in tTable do
local sKey = (type(key) == "string") and format("[%q]",key) or format("[%d]",key);

if(type(value) == "table") then
Serialize(value, sKey, sTab.."\t");
else
local sValue = (type(value) == "string") and format("%q",value) or tostring(value);
sTmp = sTmp..sTab.."\t"..sKey.." = "..sValue
end

sTmp = sTmp..",\n"
end

sTmp = sTmp..sTab.."}"
return sTmp
end

function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end

function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
end
end
Title:
Post by: QuikThinker on 04 August, 2004, 21:29:03
Appreciate that man but would u mind showin me exactly wat u changed so I can learn a bit maself?

Thanx again,
Quik.
Title:
Post by: Snooze on 04 August, 2004, 21:44:38
In the DataArrival I changed this:

function DataArrival(user, data)
if (strsub(data,1,1) == "<" or strsub(data,1,5+strlen(sBot)) == "$To: "..sBot) then
data = strsub(data,1,strlen(data)-1)
s,e,cmd = strfind(data, "%b<>%s+(%S+)")
if (cmd == "!hide" and user.iProfile <= 1) then [COLOR=red](Used to be: "if (cmd == "!hide" and user.iProfile == 0) then")[/COLOR]
if (hide[user.sName] == nil) then
hide[user.sName] = 1
frmHub:UnregBot(user.sName)
user:SendPM(sBot, "You are now hide from the user list")
else
user:SendPM(sBot, "You are already hide from the user list")
end
return 1
elseif (cmd == "!unhide" and user.iProfile <= 1) then [COLOR=red](Used to be: "if (cmd == "!unhide" and user.iProfile == 0) then")[/COLOR]
if (hide[user.sName] ~= nil) then
hide[user.sName] = nil
frmHub:RegBot(user.sName)
user:SendPM(sBot, "You are now back to the user list")
else
user:SendPM(sBot, "You are not hide from the Hub")
end
return 1
end
end
if (strsub(data,1,12) == "$GetNickList") then
RefreshHide()
end
if (strsub(data,1,5) == "$To: ") then
local s,e,usr = strfind(data, "$To:%s+(%S+)")
if (hide[usr] ~= nil) then
return 1
end
end
end

0 = Master
1 = Operator


"<= 1" means that if the users profile is less or equal  to 1 ( 1 or 0) then execute the command.

Hope it helped..

Best regards,

Snooze
Title:
Post by: h!mz316 on 04 August, 2004, 22:03:01
[20:58] The nick you are using is reserved for someone other. Change your nick and get back again.

cant get back into QuikThinkers hub :(:(:(

using Nerbos script
been trying for last 10 minutes.

p.s. biggup Snooze, doin a great job mate ;)
Title:
Post by: Snooze on 04 August, 2004, 22:19:48
In that case i suggest that you use the script by Phatty..


--Hider Bot, this one does not give the nick taken error ;)
Edit: Will work for all users with Op status
(if user.bOperator then)
Title:
Post by: QuikThinker on 05 August, 2004, 03:23:33
Thanx 4 the pointers snooze