PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: [G-T-E]Gate? on 05 May, 2004, 00:50:31

Title: Download Blocker 100%
Post by: [G-T-E]Gate? on 05 May, 2004, 00:50:31
A messege to CHILLER and all users. the script below works great inconjunction with RC7a and 326+330.
Thanks C

Quotefrom Chiller"gate you are my tester it seemd to work but dunno check for yourself."

code:--------------------------------------------------------------------------------

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) and GetItemByName(towho).bOperator then
         curUser:SendData("*** You must get registered to be able to download from an OP")
         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) and GetItemByName(towho).bOperator then
         curUser:SendData("*** You must get registered to be able to download from an OP")
         return 1
      end
   end
end
--------------------------------------------------------------------------------
Title:
Post by: Corayzon on 05 May, 2004, 05:03:29
looks good to me, but i think u should add a blocknoprofile option...so when users with no profiles tri to download they are completly blocked =]
Title:
Post by: nErBoS on 05 May, 2004, 12:38:48
Hi,

Maybe i am sleepy here but this "curUser.iProfile == -1" already does that.

Best regards, nErBoS
Title:
Post by: xfiles on 05 May, 2004, 15:57:06
Hello m8,

is that script only to prevent users of downloading from OPs!?

Regards
Title:
Post by: [NL]ZeroX on 05 May, 2004, 23:19:30
possible this wil work for blocking download to everyone if a user is not registerd (not tested yet)

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) then
curUser:SendData("*** You must get registered to be able to download")
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) then
curUser:SendData("*** You must get registered to be able to download")
return 1
end
end
end  

see this page for more info about this download blocker: http://board.univ-angers.fr/thread.php?threadid=249&boardid=12&styleid=1&sid=fe3b919428d6fb78dea2847c24f3b574

//ZeroX

//edit: little bit edit, before a user can download from also users who are unregged
Title:
Post by: xfiles on 06 May, 2004, 17:21:43
Thx m8,

I will test it. I?ll let you know if not. :)

Regards
Title: this one still works ..
Post by: UwV? on 14 May, 2004, 01:57:57
i use this "goodoldscript" ...
wich laso prevents the non regged user from searching in the hub..


--------------------CODE--------------------------------------
--ChatOnlyVar2.lua by Romulus 2003-09-14
--
--Script to prevent searching and downloading from non-registered users
--Tested with PtokaX TD4

botname="-=MembersOnly=-"

AllowSearch=0      -- If you change this value to 1 searches are possible
AllowDownload=0      -- If you change this value to 1 downloads are possible


function Main()
frmHub:EnableFullData(1)
end


function DataArrival(user, data)
data=strsub(data,1,strlen(data)-1)
if user.iProfile==-1 then
   if AllowSearch~=1 then
      if strsub(data,1,7)=="$Search" then
      user:SendData(botname,"You are not allowed to search for files. Only registered users may search!...  .. .. you can  type -> ?reg <- to find out how to do so.")
      return 1 end
   end
   if AllowDownload~=1 then
      if strsub(data,1,12)=="$ConnectToMe" then
      user:SendData(botname,"You are not allowed to download files. Only registered users may download! . .. .so type -> ?reg <- to find out how")
      return 1 end
      if strsub(data,1,15)=="$RevConnectToMe" then
      user:SendData(botname,"You are not allowed to download files. Only registered users may download! .. . ..  type -> ?reg <- and you will see how to .. ")
      return 1 end
   end
end end

--------------------- End of Code -----------------------------


one problem though ..
if the non-regged users gets granted a slot by another user..  he/she can download from them anyway..
 ( the same goes for that script above )
so i also use  .. this little gimmick -- Made by nErBoS


---------------------   CODE     ---------------------

-- Made by nErBoS

sBot = "anti-slotbeg&blablabla-come-to-my-hub-bot"


function DataArrival(user, data)
   if(strsub(data,1,5) == "$To: ") then
      local s,e,who = strfind(data, "$To:%s+(%S+)%s+From:")
      if user.iProfile == -1 then
         if(GetItemByName(who) ~= nil and not GetItemByName(who).bOperator) then
            user:SendPM(sBot, "You are not regged you can only PM OPs... Complaints ?? . . . . Go and blame D.J.Valium!")
            return 1
         end
      end
   end
end

--------------------- End of Code -----------------------------


hope this helps ..

p.s.  please can someone teach me how to do this script thing to keep the Tabs lined out in the post because i see them when i write/paste them in this litlle box here ..  but  they don't show in the post .. :0(  
Title:
Post by: F-Lazer on 24 May, 2004, 19:02:08
does those scripts even work??.. get syntax errors and nil value warnings when i trie to run them :(  .....
Title:
Post by: chill on 24 May, 2004, 19:14:10
go here to see the original codes
and the real 100% blocker.

http://board.univ-angers.fr/thread.php?threadid=249&boardid=12&styleid=1&sid=1904f05fc6c46f590760c7c5d3eba4b7&page=3