PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: blackwings on 02 September, 2004, 11:29:35

Title: non-regged - regged users
Post by: blackwings on 02 September, 2004, 11:29:35
Because someone not even answered my post in my old thread, I made this one.

I wonder if someone could make a download blocker that does this =

Here is how I wanted it to work =
Master = Can dl from everyone
Operators = Can dl from everyone
VIP = Can dl from everyone
REG = Can dl from everyone
Non-REG/Normal user = Can only dl from REG

The previous scripts made by Chilla and Pur doesn't do what I want, therefore I'm asking for someone to make a script that could do it.

Some simple way of doing this is to the script made by Pur = http://board.univ-angers.fr/thread.php?threadid=2562&boardid=11&styleid=1&sid=ef327097533be41e06907c6583f7d198 and make it to check like this =
If a non-regged user tries to dl from a normal reg, then allow, all others people with other profiles should be denied.

another example(simple java example, silly, but it illustrate what I mean)=
if(CurrentUser = Profile-1)
{  
    if(targetUser = profile3)
    {
        i = allowDL;
    }
    else
    {
        i = blockDL
    }
}
Title:
Post by: nErBoS on 02 September, 2004, 13:58:40
Hi,

Try this...

--## Made by [NL]Pur
--## Change by nErBoS to blackwings needs

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= 3) then
        curUser:SendData("*** You can only download from reg.")  
  return 1
        end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= 3) then
        curUser:SendData("*** You can only download from reg.")  
  return 1
        end
end
end

Best regards, nErBoS
Title:
Post by: blackwings on 04 September, 2004, 21:19:09
Doesn't work, a unregged  user gets blocked to dl even from normal reg. The message about this even appear when a non regged login to the hub.

Maybe it doesn't work because I test with two clients on my computer.
Title:
Post by: nErBoS on 04 September, 2004, 22:47:37
Hi,

The message will only appear when a UNREG try to download from somebody that isn't UNREG. When you say that is being blocked even from REG users, did the message popup ??

Best regards, nErBoS
Title:
Post by: blackwings on 05 September, 2004, 00:39:18
ehm, sorry, nerbos, my fault. It was a function in another script that was messing things up.

Anyway, it works now almost as I wanted. But I forgot to mention that the non-regged users should also be able to dl from other
non-regged users. In short, non-regged users shall be able to dl from Reg and other non-regged users.
Title:
Post by: nErBoS on 05 September, 2004, 02:11:42
Hi,

Done...

--## Made by [NL]Pur
--## Change by nErBoS to blackwings needs

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= 3 and GetItemByName(towho).iProfile ~= -1) then
        curUser:SendData("*** You can only download from reg.")  
  return 1
        end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= 3 and GetItemByName(towho).iProfile ~= -1) then
        curUser:SendData("*** You can only download from reg.")  
  return 1
        end
end
end

Best regards, nErBoS
Title:
Post by: blackwings on 22 October, 2004, 10:39:45
I get this errorb message in the script below here, nerbos, can you fix it? =
Syntax error: table index is nil
stack traceback:
   1:  function `DataArrival' at line 34 [file `C:\ptokax\scripts\DLBlocker.lua']
--## Made by [NL]Pur
--## Modded by nErBoS

arrRC = {}

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe") then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (curUser.iProfile == -1 and GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
        curUser:SendData("*** You can only download from other non-regged users!")
    return 1
        else
arrRC[towho] = 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (arrRC[curUser.sName] ~= nil) then
arrRC[curUser.sName] = nil
elseif (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
        curUser:SendData("*** You can only download from other non-regged users!")
  return 1
        end

end
end

I don't know if this maybe cause the error, but I recently added this script = --Description Tag by ??????Hawk?????? 05-07-2004
--Great Idea Hawk ...thx
--Adjust for your profile names if needed
--
--User Settings-------------------------------------------------------------------------------------
--
UnRegTagInDescription = "Not Regged" --Sets the tag to be shown in Unreg's descriptions
Mins =  "1" --Sets the time for the tags to be updated

--End User Settings----------------------------------------------------------------------------------
UnReg = {}

function Main()
SetTimer(12000)
StartTimer()
end

function NewUserConnected(user, data)
if (user.iProfile == -1 and UnReg[user.sName] == nil) then
UnReg[user.sName] = 1
end
end

function UserDisconnected(user, data)
if (user.iProfile == -1 and UnReg[user.sName] ~= nil) then
UnReg[user.sName] = nil
end
end

function OnTimer()
SetUnRegTag("UnReg")
end

function SetUnRegTag(User)
local aux,usr
for usr, aux in UnReg do
if (GetItemByName(usr) ~= nil) then
local profname = "[ "..UnRegTagInDescription.." ] :"
local userToShow = GetItemByName(usr)
if (userToShow.sMyInfoString ~= nil) then
local s,e,name,desc,speed,email,share = strfind(userToShow.sMyInfoString, "$MyINFO $ALL (%S+)%s+([^$]*)$ $([^$]*)$([^$]*)$([^$]+)")
SendToAll( "$MyINFO $ALL "..name.." "..profname.." "..desc.."$ $"..speed.."$"..email.."$"..share.."$")
end
end
end
end
Title:
Post by: nErBoS on 24 October, 2004, 02:48:04
Hi,

The error could not be from the first script since that script doesn't have the line 34. It couldn't be from the second one because it doesn't have the DataArrival Function. So can you show me what you have in the file "DLBlocker.lua".

Best regards, nErBoS
Title:
Post by: blackwings on 24 October, 2004, 05:22:28
QuoteOriginally posted by nErBoS
Hi,

The error could not be from the first script since that script doesn't have the line 34. It couldn't be from the second one because it doesn't have the DataArrival Function. So can you show me what you have in the file "DLBlocker.lua".

Best regards, nErBoS

why my the one I have is longer is because I have several of these where the one you see in the code = curUser:SendData("*** You can only download from other non-regged users!")
What line the error points at in my script is this line =arrRC[towho] = 1
Title:
Post by: nErBoS on 24 October, 2004, 14:26:43
Hi,

So could you show me your script please.

Best regards, nErBoS
Title:
Post by: blackwings on 24 October, 2004, 18:57:03
Here it is = --## Made by [NL]Pur
--## Modded by nErBoS

sBot = "DLBlocker"

arrRC = {}

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe") then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (curUser.iProfile == -1 and GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
        curUser:SendData("*** message1")
        curUser:SendData("*** message2")  
        curUser:SendData("*** message3")
        curUser:SendData("*** message4")
        curUser:SendData("*** message5")
        curUser:SendData("*** message6")
        curUser:SendData("*** message7")
        curUser:SendData("*** message8")
        curUser:SendPM(sBot, "*** message1")
        curUser:SendPM(sBot, "*** message2")
curUser:SendPM(sBot, "*** message3")
curUser:SendPM(sBot, "*** message4")
curUser:SendPM(sBot, "*** message5")
        curUser:SendPM(sBot, "*** message6")
        curUser:SendPM(sBot, "*** message7")
        curUser:SendPM(sBot, "*** message8")
  return 1
        else
arrRC[towho] = 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (arrRC[curUser.sName] ~= nil) then
arrRC[curUser.sName] = nil
elseif (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData("*** message1")
curUser:SendData("*** message2")  
curUser:SendData("*** message3")
curUser:SendData("*** message4")
curUser:SendData("*** message5")
curUser:SendData("*** message6")
curUser:SendData("*** message7")
curUser:SendData("*** message8")
curUser:SendPM(sBot, "*** message1")
curUser:SendPM(sBot, "*** message2")
curUser:SendPM(sBot, "*** message3")
curUser:SendPM(sBot, "*** message4")
curUser:SendPM(sBot, "*** message5")
curUser:SendPM(sBot, "*** message6")
curUser:SendPM(sBot, "*** message7")
        curUser:SendPM(sBot, "*** message8")
  return 1
        end

end
end
Title:
Post by: nErBoS on 24 October, 2004, 23:20:26
Hi,

Try out this one...

--## Made by [NL]Pur
--## Modded by nErBoS

sBot = "DLBlocker"

arrRC = {}

function Main()
    frmHub:EnableFullData(1)
end

function DataArrival(curUser, data)
if (strsub(data, 1, 15) == "$RevConnectToMe") then
local _,_,towho = strfind(data, "$RevConnectToMe%s+%S+%s+(%S+)|")
if (curUser.iProfile == -1 and GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
        curUser:SendData("*** message1")
        curUser:SendData("*** message2")  
        curUser:SendData("*** message3")
        curUser:SendData("*** message4")
        curUser:SendData("*** message5")
        curUser:SendData("*** message6")
        curUser:SendData("*** message7")
        curUser:SendData("*** message8")
        curUser:SendPM(sBot, "*** message1")
        curUser:SendPM(sBot, "*** message2")
curUser:SendPM(sBot, "*** message3")
curUser:SendPM(sBot, "*** message4")
curUser:SendPM(sBot, "*** message5")
        curUser:SendPM(sBot, "*** message6")
        curUser:SendPM(sBot, "*** message7")
        curUser:SendPM(sBot, "*** message8")
  return 1
        elseif (towho ~= nil) then
arrRC[towho] = 1
end
elseif (strsub(data, 1, 12) == "$ConnectToMe" and curUser.iProfile == -1) then
local _,_,towho = strfind(data, "$ConnectToMe%s+(%S+)%s+.*|")
if (arrRC[curUser.sName] ~= nil) then
arrRC[curUser.sName] = nil
elseif (GetItemByName(towho) ~= nil and GetItemByName(towho).iProfile ~= -1) then
curUser:SendData("*** message1")
curUser:SendData("*** message2")  
curUser:SendData("*** message3")
curUser:SendData("*** message4")
curUser:SendData("*** message5")
curUser:SendData("*** message6")
curUser:SendData("*** message7")
curUser:SendData("*** message8")
curUser:SendPM(sBot, "*** message1")
curUser:SendPM(sBot, "*** message2")
curUser:SendPM(sBot, "*** message3")
curUser:SendPM(sBot, "*** message4")
curUser:SendPM(sBot, "*** message5")
curUser:SendPM(sBot, "*** message6")
curUser:SendPM(sBot, "*** message7")
        curUser:SendPM(sBot, "*** message8")
  return 1
        end

end
end

Best regards, nErBoS
Title: non-regged userbot
Post by: BeeR on 25 October, 2004, 07:00:12
Hello :)

I'm searching for a bot that blocks non-regged from dload and search in the hub with a mess like  this
"You must be a regged user before you can search and download in this hub"
Title:
Post by: blackwings on 25 October, 2004, 11:07:13
QuoteOriginally posted by BeeR
Hello :)

I'm searching for a bot that blocks non-regged from dload and search in the hub with a mess like  this
"You must be a regged user before you can search and download in this hub"
If you want non-regged users to be totally blocked from downloading and to search,
then I recommend this script then(I think that the newest one is inside the rar file)  = http://www.plop.nl/ptokaxbots/Samplerman.php