PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: pHaTTy on 19 October, 2003, 04:43:38

Title: KeikoNoAskSlotBot
Post by: pHaTTy on 19 October, 2003, 04:43:38
here a little script i wrote for my multiscript ;)


--KeikoNoAskSlotBot by Phatty
--v1.00

Bot = "Keiko"
Time = "1" --mins to be banned for

function DataArrival(user,data)
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(Time)
SendToAll(Bot,user.sName.." was banned for "..Time.."mins for asking for a slot")
return 1
end
end


l8rr,,

-phatty
Title:
Post by: pHaTTy on 19 October, 2003, 05:05:34
Updates dont you just luv em :o)


--KeikoNoAskSlotBot by Phatty
--v1.11
--Fixed a little error
--Added warnings

Bot = "Keiko"

Warned = {}

TimeWra = "1" --mins to be banned for on first warning
TimeWrx = "2" --mins to be banned on second warning


function DataArrival(user,data)
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end


enjoy ;)

l8rr,,

-phatty
Title:
Post by: zinden on 19 October, 2003, 10:23:52
nice going  :)

Im off to test it. really thanks.....one question will it apply to ops too and only apply if the user write in pm?
Title:
Post by: pHaTTy on 19 October, 2003, 10:28:44
nope it will do in main too i can change if you wish, and yep it will apply to ops too, i will edit out ;)
Title:
Post by: pHaTTy on 19 October, 2003, 10:30:35
here is version with no aplly to ops ;)



--KeikoNoAskSlotBot by Phatty
--v1.12
--Fixed a little error
--Added warnings
--No longer allpies to ops

Bot = "Keiko"

Warned = {}

TimeWra = "1" --mins to be banned for on first warning
TimeWrx = "2" --mins to be banned on second warning


function DataArrival(user,data)
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end
end

Title:
Post by: pHaTTy on 19 October, 2003, 10:35:16
this one you can select from main and pm or just in pm


--KeikoNoAskSlotBot by Phatty
--v1.13
--Fixed a little error
--Added warnings
--No longer applies to ops
--PM checks only

Bot = "Keiko"

mainnpm=0 --1 check pm and main, 0 will check only pm

Warned = {}

TimeWra = "1" --mins to be banned for on first warning
TimeWrx = "2" --mins to be banned on second warning


function DataArrival(user,data)
if mainnpm==1 then
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end

else

if(strsub(data, 1, 4) == "$To:") then
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end
end
end
end



l8rr,,

-phatty
Title:
Post by: pHaTTy on 19 October, 2003, 10:39:18
here a little better


--KeikoNoAskSlotBot by Phatty
--v1.14
--Fixed a little error
--Added warnings
--No longer applies to ops
--PM checks only
--Minor optimisation

Bot = "Keiko"

mainnpm=0 --1 check pm and main, 0 will check only pm

Warned = {}

TimeWra = "1" --mins to be banned for on first warning
TimeWrx = "2" --mins to be banned on second warning


function DataArrival(user,data)
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
if mainnpm==1 then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end

else

if(strsub(data, 1, 4) == "$To:") then
s,e,data = strfind(data, "%b<>([%a ]+)")  
if( strfind(data, "have" and "slot") ) then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end
end
end
end



-phatty
Title:
Post by: zinden on 19 October, 2003, 12:51:07
i get a bunch of:
Syntax Error: bad argument #1 to `strfind' (string expected, got nil)

can you look in too it? im testing the last one
Title:
Post by: Alexei on 19 October, 2003, 13:14:24
I think it a stupid idea to have such a bot.... if u do not allow to ask for a slot then no1 can download anything... thats stupid.... :(
Title:
Post by: Ron_Doe on 19 October, 2003, 13:22:14
It's not stupid when you got 20 PM's when you get back from work and when closing them    the same ppl is asking for a slot 30 minutes later.
But i am going to use a TimeAd in my hub telling ppl : If you got no reply in the first Pm dont nagg about it no more.

The queue is there for a reason

Ron
Title:
Post by: zinden on 19 October, 2003, 13:27:02
yepp, get HUGE pm:s about open slots, and almost everyone isnt in the hub when i get back.

Do ppl think we are made for granting 10-20 users with slots? well, i really need it anyway in my hub, problably we got some good sharing  :)


btw the Version 1.13 seems to work, i hope you can sort it out with the last update  (uk-kingdom)pH?tt?
Title:
Post by: pHaTTy on 19 October, 2003, 17:40:51
ko and i got a little few more updates too ;)
Title:
Post by: pHaTTy on 19 October, 2003, 17:51:45
ok shud be fixed with a little extra ;)


--KeikoNoAskSlotBot by Phatty
--v1.16
--Fixed a little error
--Added warnings
--No longer applies to ops
--PM checks only
--Minor optimisation
--Added Timed Advert

Bot = "Keiko"

mainnpm=1 --1 check pm and main, 0 will check only pm

Warned = {}

TimeWra = "1" --mins to be banned for on first warning
TimeWrx = "2" --mins to be banned on second warning

function Main()
SetTimer(600000)
StartTimer()
end

function OnTimer()
SendToAll("---------=====================================================----")
SendToAll(Bot,"..///DO NOT ask for slots in this hub, YOU WILL be kicked\\\..")
SendToAll("---------=====================================================----")
end

function DataArrival(user,data)
if( strfind(data, "have" and "slot",1,1))  then
if mainnpm==1 then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end

else

if(strsub(data, 1, 4) == "$To:") then
if( strfind(data, "have" and "slot",1,1) ) then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end
end
end
end


now a timed advert too ;)

l8rr,,

-phatty
Title:
Post by: pHaTTy on 19 October, 2003, 17:56:02
little switch to switch on and off the timed add ;)


--KeikoNoAskSlotBot by Phatty
--v1.17
--Fixed a little error
--Added warnings
--No longer applies to ops
--PM checks only
--Minor optimisation
--Added Timed Advert
--Timed add switch

Bot = "Keiko"

mainnpm = 1 --1 check pm and main, 0 will check only pm
TimeAd = 1 --0 will switch off the timed add

Warned = {}

TimeWra = "1" --mins to be banned for on first warning
TimeWrx = "2" --mins to be banned on second warning

function Main()
SetTimer(600000)
StartTimer()
end

function OnTimer()
if TimedAd == 1 then
SendToAll("---------=====================================================----")
SendToAll(Bot,"..///DO NOT ask for slots in this hub, YOU WILL be kicked\\\..")
SendToAll("---------=====================================================----")
end
end

function DataArrival(user,data)
if( strfind(data, "have" and "slot",1,1))  then
if mainnpm==1 then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end

else

if(strsub(data, 1, 4) == "$To:") then
if( strfind(data, "have" and "slot",1,1) ) then
if not user.bOperator then
if Warned[user.sName]==nil then Warned[user.sName]=1
user:SendData(Bot,"Do not ask for slots...goodbye :o)")
user:TimeBan(TimeWra)
SendToAll(Bot,user.sName.." was banned for "..TimeWra.."mins for asking for a slot")
return 1
elseif Warned[user.sName]==1 then Warned[user.sName]=2
user:SendData(Bot,"Ive told you DO NOT ask for slots...goodbye :o)")
user:TimeBan(TimeWrx)
SendToAll(Bot,user.sName.." was banned for "..TimeWrx.."mins for asking for a slot on second warning")
return 1
elseif Warned[user.sName]==2 then Warned[user.sName]=nil
user:SendData(Bot,"Ok num nuts ive had enough of you...goodbye :o)")
user:Ban()
SendToAll(Bot,user.sName.." was banned for asking for slots on third warning")
return 1
end
end
end
end
end
end


-phatty
Title:
Post by: zinden on 21 October, 2003, 08:53:24
is it possible to make the script only apply to ops?
i mean do not ask ops for slots.....

So regular users can ask others, but no ops...
Title: Objection
Post by: BrokenBrick on 22 October, 2003, 02:08:01
Good idea, but I suggest you change the triggers "have" and "slot" to something like "can" "have" "slot."  Lets say someone was looking for a file, and they found only users with no slots, and asked in the man chat if anyone had it that did have open slots. when someone replied, "I have a slot, " they would of course be banned.  If someone uses "can" most likely they are asking a question and not making a statement, which cuts down on unfair bans ;)
Title:
Post by: pHaTTy on 22 October, 2003, 05:59:24
yes true, i will sort it asap, bit bizzy atm....:(