Free Slot Bot
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Free Slot Bot

Started by nErBoS, 20 October, 2003, 13:04:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nErBoS

Hi all,

I need a slot script to users see if is any free slot on the Hub !!

Best regards, nErBoS
--## nErBoS Spot ##--

Azmodan

I used to use the Code below, but Robocop 4 has it now inbuilt, so i use it instead...

-------------------------------------------------------------------
-- Adaptation by OpiumVolage (01 Jully 2003) based on

-- retrobot? v0.99?

-- slots module

-- by tezlo

-- 2003


-- syntax: slots [|]

-- Reintroduced user check. OpiumVolage (10 Jully 2003)

-- Sending results in PM, ... Bolamix, au taf pour la V.F. :))


-- Config


botName = "!Slots"

tmrSlots = 3 -- Number of seconds waiting for replys

tabSlots = {n=0}

Command = "Slots"



-- library


function getid(table, name)

return foreachi(table, function(id, item) if item.sName == %name then return id end end)

end


function putitem(table, item)

if not item then return end

local id = getid(table, item.sName)

if id then table[id] = item

else tinsert(table, item) id = table.n

end return id

end



-- events


function OnTimer()

local i = 1 while tabSlots do

local table = tabSlots

if clock() >= table.iClock + tmrSlots then

if table.tItems.n == 0 then SendToNick(table.sName, "<"..botName.."> No users with free slots found|") end

SendPmToNick(table.sName, botName, "Done")

tremove(tabSlots, i)

if tabSlots.n == 0 then frmHub:EnableSearchData(0) end

else i = i + 1 end

end

end


function slotsOnHub(user, args)

local s, e, free, all = strfind(args, " (%d+)/(%d+)"..strchar(5))

foreachi(tabSlots, function(id, item)

if not getid(item.tItems, %user.sName) then

putitem(item.tItems, { sName = %user.sName, sValue = %free.."/"..%all })

if item.sTarget and (strlower(%user.sName) == item.sTarget) then

SendPmToNick(item.sName, botName, "    user "..%user.sName.." "..%free.."/"..%all.."|")

item.iClock = item.iClock - tmrSlots

elseif not item.sTarget and (tonumber(%free) >= item.iNR) then

SendPmToNick(item.sName, botName, "    user "..%user.sName.." "..%free.."/"..%all.."|")

end

end end)

end


function doSlots(user, nr, nick)

if nick then nick = strlower(nick) end

SendPmToNick(user.sName, botName, " Checking..|")

frmHub:EnableSearchData(1)

SendToAll("$Search Hub:"..Command.." T?F?0?1?.|")

putitem(tabSlots, { sName = user.sName, sTarget = nick, iClock = clock(), iNR = nr, tItems = {n=0}  })

end



-- init


function DataArrival(user, data)

if strfind(data, "%b<>%s+("..Command..").*|") then

local s, e, param = strfind(data, "%b<>%s+"..Command.."%s+(%S+).*|")

if s then

if strfind(param, "^[0-9]+$") then

local nr = tonumber(param)

elseif not GetItemByName(param) then

param = nil

user:SendData("<"..botName.."> No user with that name..|")

return 1

else nr = 0 end

else nr = 1 end

doSlots(user, nr, param) return 1

end

if strfind(data, "^%$SR") then slotsOnHub(user, data) end

end


function Main()

frmHub:RegBot(botName)

SetTimer(1000)

StartTimer()

end
-------------------------------------------------------------------

hope thats what u were after ;-)

cheers, Az

nErBoS

That script makes conflit with the Bad Files script every user with a free slot will be kicked by the Bad File saying "Other Files"
--## nErBoS Spot ##--

[NL]Pur

could you paste that bad file script here ?

nErBoS

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

BotName = "(-Alexandra-)" 

Files = { 
[".dll"]="No .dll 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!", 
[".mp3"]="No .ocx files in this hub, hang on!" 
} 


function NewUserConnected(user) 
frmHub:EnableSearchData(1) 
for i,v in Files do 
user:SendData("$Search Hub:"..BotName.." 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)
	local s = 5 + strlen(user.sName)
	Reason = FindWhat(data) 
	user:SendData(BotName, "Reason: "..Reason) 
	user:SendData(BotName, "Path: "..path.. ".") 
	user:SendData(BotName, "Disconnected....") 
	user:Disconnect()
	user:TempBan()
	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
--## nErBoS Spot ##--

[NL]Pur

you don't want mp3 files ???

[".mp3"]="No .ocx files in this hub, hang on!"


because when someone searches

the dataarrival is fired and the function findwhat will always return  "other files".  It doesn't specify which file the user is kicked for.

so the kick is not a conflict with slots script

[ES]latinmusic

QuoteOriginally posted by [NL]Pur
because when someone searches

the dataarrival is fired and the function findwhat will always return  "other files".  It doesn't specify which file the user is kicked for.

so the kick is not a conflict with slots script
Yeep, and how can we fix that?

OpiumVolage

Just add this line (i think :)

Reason = FindWhat(data)
if (Reason == "Other files") then return end
user:SendData(BotName, "Reason: "..Reason)

[ES]latinmusic

That was easy, going to test it.

nErBoS

QuoteOriginally posted by [NL]Pur
you don't want mp3 files ???

[".mp3"]="No .ocx files in this hub, hang on!"


because when someone searches

the dataarrival is fired and the function findwhat will always return  "other files".  It doesn't specify which file the user is kicked for.

so the kick is not a conflict with slots script

This was a test bot !! I put the mp3 tu test it !!
--## nErBoS Spot ##--

[ES]latinmusic

QuoteOriginally posted by OpiumVolage
Just add this line (i think :)

Reason = FindWhat(data)
if (Reason == "Other files") then return end
user:SendData(BotName, "Reason: "..Reason)
Works

[NL]Pur

function FindWhat(data) 
for i,v in Files do 
if( strfind(strlower(data), i) ) then 
return v 
end 
end 
return "Other files" 
end 
 


doesn't findwhat always return "other files" here ?

[ES]latinmusic

#12
I have a problem with the script posted here, the one made by ptacek and last modified by erboss.
If i set more file extensions into the array for file control (more than 10 perhaps), the hub is spammed and the following message is displayed:
*** Search spam detected from (-Alexandra-)
How can i fix that without removing of course the file extensions added?.

[ES]latinmusic

No one have a solution for this problem here  ?(

pHaTTy

QuoteOriginally posted by [ES]latinmusic
I have a problem with the script posted here, the one made by ptacek and last modified by erboss.
If i set more file extensions into the array for file control (more than 10 perhaps), the hub is spammed and the following message is displayed:
*** Search spam detected from (-Alexandra-)
How can i fix that without removing of course the file extensions added?.

Hahaha that is supposed to be there, is searching for the files from users.........;)
Resistance is futile!

OpiumVolage

QuoteOriginally posted by [ES]latinmusic
I have a problem with the script posted here, the one made by ptacek and last modified by erboss.
If i set more file extensions into the array for file control (more than 10 perhaps), the hub is spammed and the following message is displayed:
*** Search spam detected from (-Alexandra-)
How can i fix that without removing of course the file extensions added?.

You can modify this part of the code:

user:SendData("$Search Hub:"..BotName .." F?F?0?1?"..i)

by adding a random number to the botname.

user:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)

[ES]latinmusic

QuoteOriginally posted by OpiumVolage
user:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
Great, thanks opium, i'm going to test it.
Can you explain me what does: random(1, 100)?.  I supposse you pick ramdomly one extension and check for it, on new user connected. I'm interesting in the number '100' exactly, if this one means the last number in array, i can decrease the number to the real number in array, is correct?.
Can you or someone make another solution to this script using a timer?.

[ES]latinmusic

This script is giving me a lot of troubles  ;(
If you disconnect for extensions like for instance: '.pass' and one user have a valid file called passion.mp3, the script tempban the user  :(
How can i fix this script?, i need sometning like '==.pass'
Does any one knows another script like this one who can also retrieve the path to send it to the user or can fix this one?

OpiumVolage

QuoteOriginally posted by [ES]latinmusic
user:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
Can you explain me what does: random(1, 100)?.
It randomly add an number between 1 and 100 to the botname. Like this, your dc++ can't count more thant 10 search from the same user (the bot) and don't show the message "search spam...".

OpiumVolage

QuoteOriginally posted by [ES]latinmusic
This script is giving me a lot of troubles  ;(
If you disconnect for extensions like for instance: '.pass' and one user have a valid file called passion.mp3, the script tempban the user  :(
How can i fix this script?, i need sometning like '==.pass'
Does any one knows another script like this one who can also retrieve the path to send it to the user or can fix this one?

Try this (untested):

function FindWhat(data)
for i,v in Files do
if( strfind(strlower(data), i, 1, 1)  ) then

The "." mean any char. in an strfind, the last parameter of strfind mean "Plain text".

[ES]latinmusic

QuoteOriginally posted by OpiumVolage Try this (untested):

function FindWhat(data)
for i,v in Files do
if( strfind(strlower(data), i, 1, 1)  ) then

The "." mean any char. in an strfind, the last parameter of strfind mean "Plain text".
Thanks opium, you are helping me a lot :)
Ok, about this fix does not work as expected, what i need is to check exactly the last 4 characters in files in share, i mean --> .extension. Ex: .ocx. We can have 'shortname.extension' or we can have 'folder\folder\longname even including spaces.extension'
I need strfind look ONLY for the last 4 charaters and match exactly the extension some thing like '=='. How can we do this?.

In the scripts i have the following line:
[".pas"]="No .pas files in this hub, hang on!"

With your fix here is an example of the result when the script is working:
<(-Alexandra-)> Disconnecting.....
<(-Alexandra-)> Path:  tosharedc\Salsa\Mimi Ibarra\Grandes Exitos\05.Paso A Paso.mp3.
Note the text remarked in bold. The user is disconnected althougth he have a valid share.
How can we do to fix this problem?

******************************
Your comment about add a ramdom number into script works like heaven, i mean the following line:
user:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)

OpiumVolage

Hmmm, i see the problem.

The searchkicker script i tranlated from dch++ solved this problem by using a regex as additional parameter.

It can be possible to modify this script to search only for extentions (something at the end of the file), i've just got to find the good regex :)

OpiumVolage

try to replace your strfind with:

strfind(strlower(data), "%"..i.."\005")

This should escape the leading dot and terminate with ascii code 5 to find the end of the string.

Completly untested ;)

[ES]latinmusic

Great, going to test it in a few minutes here, i will tell you how works :)

[ES]latinmusic

Opium, you are the man!, works like heaven.
Here is the resultant code:
Tested.
Works
-- BadFilesDetecter v: 1.0
-- Created by Ptaczek, Jan-3, 2003 
-- Searches for specified patterns. Useful for illegal share checking 
-- Modificed by Leo (for music hub) 
-- Modified by nErBoS
-- Modified by latinmusic
-- Operators are now checked as normal users
-- Some extensions added
-- All known bugs fixed by ----------->>> OpiumVolage
-- Date: 05/11/2003
BotName = "![BadFilesDetecter]!?"
MessageToSend = " are not allowed in this hub."
time = 3 --Value in minutes
Files = { 
[".dll"]="No .dll files in this hub, you have been banned for "..time.." minutes.",
[".sys"]="No .sys files in this hub, you have been banned for "..time.." minutes.",
[".ini"]="No .ini files in this hub, you have been banned for "..time.." minutes.",
[".php"]="No .php files in this hub, you have been banned for "..time.." minutes.",
[".hlp"]="No .hlp files in this hub, you have been banned for "..time.." minutes.",
[".lnk"]="No .lnk files in this hub, you have been banned for "..time.." minutes.",
[".cue"]="No .cue files in this hub, you have been banned for "..time.." minutes.",
[".pkg"]="No .pkg files in this hub, you have been banned for "..time.." minutes.",
[".lib"]="No .lib files in this hub, you have been banned for "..time.." minutes.",
[".ins"]="No .ins files in this hub, you have been banned for "..time.." minutes.",
[".cmd"]="No .cmd files in this hub, you have been banned for "..time.." minutes.",
[".bat"]="No .bat files in this hub, you have been banned for "..time.." minutes.",
[".cod"]="No .cod files in this hub, you have been banned for "..time.." minutes.",
[".cox"]="No .cox files in this hub, you have been banned for "..time.." minutes.",
[".loc"]="No .loc files in this hub, you have been banned for "..time.." minutes.",
[".cnt"]="No .cnt files in this hub, you have been banned for "..time.." minutes.",
[".vxd"]="No .vxd files in this hub, you have been banned for "..time.." minutes.",
[".vga"]="No .vga files in this hub, you have been banned for "..time.." minutes.",
[".stb"]="No .stb files in this hub, you have been banned for "..time.." minutes.",
[".chp"]="No .chp files in this hub, you have been banned for "..time.." minutes.",
[".nrg"]="No .nrg files in this hub, you have been banned for "..time.." minutes.",
[".iso"]="No .iso files in this hub, you have been banned for "..time.." minutes.",
[".vob"]="No .vob files in this hub, you have been banned for "..time.." minutes.",
[".pas"]="No .pas files in this hub, you have been banned for "..time.." minutes.",
[".vcf"]="No .vcf files in this hub, you have been banned for "..time.." minutes.",
[".dfm"]="No .dfm files in this hub, you have been banned for "..time.." minutes.",
[".res"]="No .res files in this hub, you have been banned for "..time.." minutes.",
[".reg"]="No .reg files in this hub, you have been banned for "..time.." minutes.",
[".vdi"]="No .vdi files in this hub, you have been banned for "..time.." minutes.",
[".map"]="No .map files in this hub, you have been banned for "..time.." minutes.",
[".scr"]="No .scr files in this hub, you have been banned for "..time.." minutes.",
[".diz"]="No .diz files in this hub, you have been banned for "..time.." minutes.",
[".lst"]="No .lst files in this hub, you have been banned for "..time.." minutes.",
[".pdf"]="No .pdf files in this hub, you have been banned for "..time.." minutes."
} 
function NewUserConnected(curUser)
	frmHub:EnableSearchData(1)
	for i,v in Files do
	curUser:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
	end
end
function OpConnected(curUser)
	frmHub:EnableSearchData(1)
	for i,v in Files do
		curUser:SendData("$Search Hub:"..BotName..random(1, 100) .." F?F?0?1?"..i)
	end
end
function DataArrival(curUser, data)
	if( strsub(data, 1, 3) == "$SR" ) then
		_,_,nick = strfind( data, "\05(%S*)|$" )
		local s = 5 + strlen(curUser.sName)
		local e = strfind(data, "%d+%s%d+/%d+") - 2
		local path = strsub(data, s, e)
		local s = 5 + strlen(curUser.sName)
		Reason = FindWhat(curUser,data)
		if (Reason == "Other files") then return end
		curUser:SendData(BotName, "Disconnecting.....")
		curUser:SendData(BotName, "Reason: "..Reason)
		curUser:SendData(BotName, "Path: "..path.. ".")
		curUser:Disconnect()
		curUser:TimeBan(time) --This line tempban a user for an specific amount of time in minutes, to incree/decrease the time change the value in variable 'time'
--		curUser:TempBan() --This line tempban a user for an specific amount of time pre-setted inside ptokax advanced settings, to make it work, uncomment this line and comment the line above
	end
end
function FindWhat(curUser,data)
	for i,v in Files do
		if (strfind(strlower(data), "%"..i.."\005")) then
			return v
		end
	end
	return "Other files"
end

SMF spam blocked by CleanTalk