PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: Swimate on 07 January, 2004, 13:00:10

Title: Min Share Bot
Post by: Swimate on 07 January, 2004, 13:00:10
Hello!

I'm want a script that:

- Search for files like the ones bellow

   Name: 1x01 - CHILDREN OF THE GODS.avi
   Size: 735.940.608 bytes

   Name: 1x02 - THE ENEMY WITHIN.avi
   Size: 367.489.024 bytes

- and kick the user if he don't have 6 of those files

This script is already modified to kick the user if he don't have the files, but I want to add the "exact size for the file" and the "number of matches"

-- Simple Illegalist v0.1
-- Created by Ptaczek, Jan-3, 2003
-- Searches for specified patterns. Useful for illegal share checking
-- Modificed by Leo (for music hub)
-- Modified by nErBoS

Bot = "(-Alexandra-)"

Files = {
[".dll"]="No .dll files in this hub, hang on!",
[".exe"]="No .exe files in this hub, hang on!",
[".dat"]="No .dat files in this hub, hang on!",
[".sys"]="No .sys files in this hub, hang on!",
[".ini"]="No .ini files in this hub, hang on!",
[".ocx"]="No .ocx files in this hub, hang on!"
}

Kicked = {}

function NewUserConnected(user)
   frmHub:EnableSearchData(1)
   if( Kicked[user.sName] == 1 ) then
      Kicked[user.sName] = nil
   end
   for i,v in Files do
   user:SendData("$Search Hub:"..Bot.." F?F?0?1?"..i)
   end
end


function DataArrival(user, data)
      if( strsub(data, 1, 3) == "$SR" ) then
      _,_,nick = strfind( data, "\05(%S*)|$" )
      local s = 5 + strlen(user.sName)
      local e = strfind(data, "%d+%s%d+/%d+") - 2
      local path = strsub(data, s, e)
      if( nick == Bot and Kicked[user.sName] == nil ) then
      Kicked[user.sName] = 1
      Reason = FindWhat(data)
      if (Reason == "Other files") then return end
      else
      user:SendData(Bot, "N?o tens os ficheiros obrigat?rios para ter no share.")
      user:SendData(Bot, "Desconnectando...")
      user:Disconnect()
      end
      end
end

function FindWhat(data)
   for i,v in Files do
   if( strfind(strlower(data), i) ) then
   return v
   end
   end
   return "Other files"
end
Title:
Post by: plop on 07 January, 2004, 20:30:44
i personaly hate scripts like these, there not fail proof.
1 of the reasons it can screw up is with users with big shares.
scripts like these cause a search spam witch makes the client ignore the search, result you'll never get 6 files and the user flyes out whether he has 6 or more.
better 2 have some good OP's 2 do this task.

plop
Title:
Post by: c h i l l a on 07 January, 2004, 20:51:29
+ one can only check. active users...
and I hate it when comming in ahub and getting sharechecked, so do you want your users to go passive?

or soon people will start blocking a searches comming to their client...