Little problem with share hider (from userlist only) script
 

Little problem with share hider (from userlist only) script

Started by Naithif, 05 July, 2006, 14:06:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Naithif

Hi

Can somebody help with this script? It's been converted to Lua 5.1 but it (I think) has a bug - it generates a sharehidden.lst file, and saves who's hiding his / her share but it doesn't seem to read it when he / her connects to the hub - the share's still visible.

-- Ops Share Hider Script By ??????Hawk??????
-- 28/11/2005
-- Hides Your Share From the user list
-- Compatible with Terminator One
-- http://www.hawks-world.com

function Main()
sTable["loadfile"]()
end


OpConnected = NewUserConnected

function OnTimer()
for a,b in pairs(sTable.Hiders) do
Nick = GetItemByName(a)
if Nick then
s,e,name,desc,speed,email,share = string.find(Nick.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$0$")
end
end
  StopTimer()
end


function ChatArrival(user, data)
local s, e, cmd = string.find(data, "%b<>%s+(%S+).*|")
if sTable.tAllowList[user.iProfile] == 1 and cmd and sTable.commands[cmd] then
return sTable.commands[cmd](user, data)
end
end

sTable = {
["Menu"] = "Share-Hider",
["Bot"] = frmHub:GetHubBotName(),
Hiders = {},

tAllowList = {
[0] = 1,
[1] = 1,
[2] = 0, --// Profiles Allowed to use the command  1 yes  / 0 No
[3] = 0,
[4] = 0,
[5] = 1,
},

commands = {
["!unhideshare"] = function(user, data)
if sTable.Hiders[user.sName] then
local s,e,name,desc,speed,email,share = string.find(user.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
sTable.Hiders[user.sName] = nil
user:SendData(sTable["Bot"]," Share back in userlist!")
end
return 1
end,

["!hideshare"] = function(user, data)
local s,e,name,desc,speed,email,share = string.find(user.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..desc.."$ $"..speed.."$"..email.."$0$")
sTable.Hiders[user.sName] = 1
sTable["SaveTable"]()
user:SendData(sTable["Bot"]," Share hidden from userlist!")
return 1
end ,
},

["loadfile"] = function()
local f,e = io.open("ShareHidden.lst","r")
if f then
while 1 do
line = f:read("*l")
if line ==  nil then
break
end
local s,e,InfoOne,InfoTwo = string.find(line, "(.+)$$$(.+)")
if InfoOne ~= nil then
sTable.Hiders[InfoOne]=InfoTwo
end
end
f:close(f)
else
f,e = io.open("ShareHidden.lst", "w" )
f:write()
f:close()
end
end,

["SaveTable"] = function()
local ipairs f,e = io.open("ShareHidden.lst", "w" )
for aaa,bbb in pairs(sTable.Hiders) do
f:write(aaa.."$$$"..bbb.."\n")
end
f:close()
end,
}

Naithif

Thanks Mutor, but looks like it has the same problem as the script I use to update my bot's myinfos - On connect, a user can see the real sharesize (in the case of script), and after a half second lag, the share switches to nil. So I guess there's no way for myinfo to arrive instantly as the user connects.  :( Thanks for your help anyway, nice script  :)

Markitos

Quote from: Naithif on 06 July, 2006, 10:01:00
Thanks Mutor, but looks like it has the same problem as the script I use to update my bot's myinfos - On connect, a user can see the real sharesize (in the case of script), and after a half second lag, the share switches to nil. So I guess there's no way for myinfo to arrive instantly as the user connects.  :( Thanks for your help anyway, nice script  :)
Changing the timer to 0 would solve the prob???

Naithif

Quote from: Markitos on 06 July, 2006, 10:23:12
Quote from: Naithif on 06 July, 2006, 10:01:00
Thanks Mutor, but looks like it has the same problem as the script I use to update my bot's myinfos - On connect, a user can see the real sharesize (in the case of script), and after a half second lag, the share switches to nil. So I guess there's no way for myinfo to arrive instantly as the user connects.  :( Thanks for your help anyway, nice script  :)
Changing the timer to 0 would solve the prob???

No, I've tried that too, even at 10, there's no update at all (for me at least)

Naithif

Quote from: Mutor on 06 July, 2006, 10:32:14
You're right it's currently set for exactly 1/2 second [500ms]
Quote from: Naithif on 06 July, 2006, 10:01:00
So I guess there's no way for myinfo to arrive instantly as the user connects.

You're right there too, MyINFO is not blockable, never was.
However, you do have some options, in the Px GUI -> Options -> MyINFO processing
You can strip description, tag, connection & mail. Share is not optional.
You can also set which profiles may receive user MyINFO as well.

So the only way to effectively hide the share's quantity (just the quantity, no connect / searchblock) is through the hubsoft (if it would support that)?
I've seen such a request in the PtokaX request section, but I thought that it's possible via script.
Thanks for your help Mutor :)

SMF spam blocked by CleanTalk