PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: plop on 20 March, 2004, 00:16:38

Title: max hub public kick battle
Post by: plop on 20 March, 2004, 00:16:38
didn't feel like doing something serious 2day and this was the result.
enjoy.
-- it anounces users who enter who are in more then the max hubs set.
-- after that the users have 2 count down from 10 to 0.
-- the fastest user gets the honor of the kick.
-- why?? because it's fun!


Bot = "public_kickbattle"
MaxHubs = 20
FunTable = {}
FunComp = {}

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if user.sMyInfoString then
      s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
      if thubs ~= nil then
         hubs = 0
         if tonumber(thubs) == nil then
            gsub(thubs, "(%d+)", function (num)
            hubs = hubs +tonumber(num)
            end)
         else
            hubs = tonumber(thubs)
         end
         if hubs >= MaxHubs then
            if FunTable[user.sName] == nil then
               SendToAll(Bot, user.sName.." was found in the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[user.sName] = 10
            end
         end
      end
   end
   if( strsub(data, 1, 1) == "<" ) then
      local s,e,num=strfind(data, "%b<>%s+(%d+)")
      if tonumber(num) then
         num = tonumber(num)
         if num <= 10 then
            if FunComp[user.sName] == nil then
               FunComp[user.sName]=10
               if num == 10 then
                  FunComp[user.sName]= 9
                  for a,b in FunTable do
                     if num == b then
                        FunTable[a]=(b-1)
                     end
                  end
               end
            elseif num == (FunComp[user.sName]) then
               FunComp[user.sName]= FunComp[user.sName] -1
               for a,b in FunTable do
                  if num == b then
                     FunTable[a]=(b-1)
                     if FunTable[a] == -1 and FunComp[user.sName] == -1 then
                        local vic = GetItemByName(a)
                        FunTable[a]=nil
                        FunComp=nil
                        FunComp = {}
                        if vic then
                           SendToAll(Bot, user.sName.." is the lucky winner and kicked "..vic.sName.."!|")
                           vic:SendPM(Bot, "your kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           vic:Disconnect()
                        end
                     end
                  end
               end
            end
         end
      end
   end
end

function NewUserConnected(user)
   s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
   if thubs ~= nil then
      hubs = 0
      if tonumber(thubs) == nil then
         gsub(thubs, "(%d+)", function (num)
         hubs = hubs +tonumber(num)
         end)
      else
         hubs = tonumber(thubs)
      end
      if hubs >= MaxHubs then
         if FunTable[user.sName] == nil then
            SendToAll(Bot, user.sName.." has entered the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
            FunTable[user.sName] = 10
         end
      end
   end
end
plop

* edit: tiny bug found. thx kepp.
* edit again: tiny bug found, now thx plop.
Title:
Post by: [NL]Pur on 20 March, 2004, 00:22:26
great idea :D
Title:
Post by: yepyepyep4711 on 30 March, 2004, 00:44:33
did you give it some thought, about binding it to dc++k /CDM?

cheers
Title:
Post by: Carnage on 13 April, 2004, 22:59:03
Hehe i love it :)

just one little glitch  .. can't u make it so it doesn't count for OP's ?
Title:
Post by: plop on 14 April, 2004, 15:46:18
QuoteOriginally posted by yepyepyep4711
did you give it some thought, about binding it to dc++k /CDM?

cheers
yep but haven't made it yet. lol
but it's a real cool idea.

plop
Title:
Post by: Carnage on 14 April, 2004, 20:25:11
No OP fix yet then ?

Damnz  :D
Title:
Post by: plop on 14 April, 2004, 21:25:10
QuoteOriginally posted by Carnage
No OP fix yet then ?

Damnz  :D
not checking OP's or not battling OP's??

plop
Title:
Post by: Carnage on 14 April, 2004, 22:05:46
Not checking OP's would be nice :)

Since my hub is in a network and most of the OP's are in all the hubs .. the limit sometimes is more then the allowed limit for normal users  8)
Title:
Post by: yepyepyep4711 on 15 April, 2004, 10:27:27
QuoteOriginally posted by plop
QuoteOriginally posted by yepyepyep4711
did you give it some thought, about binding it to dc++k /CDM?

cheers
yep but haven't made it yet. lol
but it's a real cool idea.

plop

waking up today with what I think is an idea to do it quite simply :D. Add the following command to the bot:
!abuser

This command can be used as a raw in ++k, as well as in main by a user.

So if someone (++k for example) goes:
!abuser UglyBastard using StealthDC

The bot then goes:
UglyBastard has been named an abuser by SheriffOfTheDay for the following reason: using StealthDC, pls countdown down from 10 to 0 and you could be the one to kick his ass!!

What do you think?

Cheers
Title:
Post by: plop on 15 April, 2004, 13:00:46
both requests done but untested.
-- it anounces users who enter who are in more then the max hubs set.
-- after that the users have 2 count down from 10 to 0.
-- the fastest user gets the honor of the kick.
-- why?? because it's fun!
-- added bypase for op's
-- added command so op's can nominate users 2 (reason must be given)


Bot = "public_kickbattle"
MaxHubs = 20
FunTable = {}
FunComp = {}

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if user.sMyInfoString and user.bOperator == nil then
      s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
      if thubs ~= nil then
         hubs = 0
         if tonumber(thubs) == nil then
            gsub(thubs, "(%d+)", function (num)
            hubs = hubs +tonumber(num)
            end)
         else
            hubs = tonumber(thubs)
         end
         if hubs >= MaxHubs then
            if FunTable[user.sName] == nil then
               SendToAll(Bot, user.sName.." was found in the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[user.sName] = 10
            end
         end
      end
   end
   if( strsub(data, 1, 1) == "<" ) then
      local s,e,num=strfind(data, "%b<>%s+(%S+)")
      if tonumber(num) then
         num = tonumber(num)
         if num <= 10 then
            if FunComp[user.sName] == nil then
               FunComp[user.sName]=10
               if num == 10 then
                  FunComp[user.sName]= 9
                  for a,b in FunTable do
                     if num == b then
                        FunTable[a]=(b-1)
                     end
                  end
               end
            elseif num == (FunComp[user.sName]) then
               FunComp[user.sName]= FunComp[user.sName] -1
               for a,b in FunTable do
                  if num == b then
                     FunTable[a]=(b-1)
                     if FunTable[a] == -1 and FunComp[user.sName] == -1 then
                        local vic = GetItemByName(a)
                        FunTable[a]=nil
                        FunComp=nil
                        FunComp = {}
                        if vic then
                           SendToAll(Bot, user.sName.." is the lucky winner and kicked "..vic.sName.."!|")
                           vic:SendPM(Bot, "your kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           vic:Disconnect()
                        end
                     end
                  end
               end
            end
         end
      elseif num == "!abuser" and user.bOperator then
         local s,e,vic,why=strfind(data, "%b<>%s+%S+%s*(%S*)%s*(.*)")
         if why == "" then
            user:SendData(Bot, "I need a user name!|")
            return 1
         elseif why == "" then
            user:SendData(Bot, "Sorry, need a reason!|")
            return 1
         elseif GetItemByName(vic) then
            if FunTable[vic] == nil then
               SendToAll(Bot, vic.." has been named an abuser by "..user.sName.." for the following reason: "..why..", pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[vic] = 10
               return 1
            end
         else
            user:SendData(Bot, "Unknown user!|")
            return 1
         end
      end
   end
end

function NewUserConnected(user)
   s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
   if thubs ~= nil then
      hubs = 0
      if tonumber(thubs) == nil then
         gsub(thubs, "(%d+)", function (num)
         hubs = hubs +tonumber(num)
         end)
      else
         hubs = tonumber(thubs)
      end
      if hubs >= MaxHubs then
         if FunTable[user.sName] == nil then
            SendToAll(Bot, user.sName.." has entered the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
            FunTable[user.sName] = 10
         end
      end
   end
end
plop
Title:
Post by: yepyepyep4711 on 15 April, 2004, 13:38:29
great! Here the results of a few tests.

!abuser does nothing (doesn't say "I need a username", or whatever)
!abuser says "I need a username"
!abuser _ (space) starts the kickbattle with blank reason, and doesn't kick in the end
!abuser starts the kickbattle, but doesn't kick in the end.

The kickbattle for too many hubs does the same (doesn't kick).

The bypass for ops seems too work :]
Title:
Post by: plop on 16 April, 2004, 00:02:45
found the bug but it was really weird.
but won't bore you with it. lol
here it is.
-- it anounces users who enter who are in more then the max hubs set.
-- after that the users have 2 count down from 10 to 0.
-- the fastest user gets the honor of the kick.
-- why?? because it's fun!
-- added bypase for op's
-- added command so op's can nominate users 2 (reason must be given)


Bot = "public_kickbattle"
MaxHubs = 20
FunTable = {}
FunComp = {}

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if user.sMyInfoString and user.bOperator == nil then
      s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
      if thubs ~= nil then
         hubs = 0
         if tonumber(thubs) == nil then
            gsub(thubs, "(%d+)", function (num)
            hubs = hubs +tonumber(num)
            end)
         else
            hubs = tonumber(thubs)
         end
         if hubs >= MaxHubs then
            if FunTable[user.sName] == nil then
               SendToAll(Bot, user.sName.." was found in the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[user.sName] = 10
            end
         end
      end
   end
   if( strsub(data, 1, 1) == "<" ) then
      local s,e,num=strfind(data, "^%b<>%s+(%d+)")
      if tonumber(num) then
         num = tonumber(num)
         if num <= 10 then
            if FunComp[user.sName] == nil then
               FunComp[user.sName]=10
               if num == 10 then
                  FunComp[user.sName]= 9
                  for a,b in FunTable do
                     if num == b then
                        FunTable[a]=(b-1)
                     end
                  end
               end
            elseif num == (FunComp[user.sName]) then
               FunComp[user.sName]= FunComp[user.sName] -1
               for a,b in FunTable do
                  if num == b then
                     FunTable[a]=(b-1)
                     if FunTable[a] == -1 and FunComp[user.sName] == -1 then
                        local vic = GetItemByName(a)
                        FunTable[a]=nil
                        FunComp=nil
                        FunComp = {}
                        if vic then
                           SendToAll(Bot, user.sName.." is the lucky winner and kicked "..vic.sName.."!|")
                           vic:SendPM(Bot, "your kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           vic:Disconnect()
                        end
                     end
                  end
               end
            end
         end
      else
         local s,e,num=strfind(data, "^%b<>%s+(%S+)")
         if num == "!abuser" and user.bOperator then
            local s,e,vic,why=strfind(data, "%b<>%s+%S+%s*(%S*)%s*(.*)")
            if vic == "" then
               user:SendData(Bot, "I need a user name!|")
               return 1
            elseif why == "" then
               user:SendData(Bot, "Sorry, need a reason!|")
               return 1
            elseif GetItemByName(vic) then
               if FunTable[vic] == nil then
                  SendToAll(Bot, vic.." has been named an abuser by "..user.sName.." for the following reason: "..why..", pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
                  FunTable[vic] = 10
                  return 1
               end
            else
               user:SendData(Bot, "Unknown user!|")
               return 1
            end
         end
      end
   end
end

function NewUserConnected(user)
   s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
   if thubs ~= nil then
      hubs = 0
      if tonumber(thubs) == nil then
         gsub(thubs, "(%d+)", function (num)
         hubs = hubs +tonumber(num)
         end)
      else
         hubs = tonumber(thubs)
      end
      if hubs >= MaxHubs then
         if FunTable[user.sName] == nil then
            SendToAll(Bot, user.sName.." has entered the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
            FunTable[user.sName] = 10
         end
      end
   end
end
plop
Title:
Post by: yepyepyep4711 on 16 April, 2004, 00:33:54
it works! :)

here the results of the tests:

!abuser gives nothing
!abuser_ (space) gives "Sorry, need a reason!"
nothing important, but maybe having it say "syntax is !abuser " in both cases would be nice.

It doesn't print out the real reason to the kicked person, so if for example I use

!abuser testuser you are a test user

it kicks testuser with the text:
your kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from yepyepyep4711 as he won the battle.

It would be nice to incorporate the reason stated in the commandin this :)

last but not least, it doesn't kick, it drops. I intend to use this to let the users do the work and letting them have fun doing it, so I would need it to kick on behalf of the user that won, so that it get registred by TopTen :D

EDIT: omg I have another idea for this script :D
make different punishment possible, like !abuse.d will end in a drop, !abuse.k will end in a kick, !abuse.nb will end in a nickban, etc...
I guess issueing the corresponding command in main on behalf of the winner would do the trick nicely, what do you think?
Title:
Post by: plop on 21 April, 2004, 15:04:30
shows the correct reason now on users who get nominated by the !abuser command.
-- it anounces users who enter who are in more then the max hubs set.
-- after that the users have 2 count down from 10 to 0.
-- the fastest user gets the honor of the kick.
-- why?? because it's fun!
-- added bypase for op's
-- added command so op's can nominate users 2 (reason must be given)


Bot = "public_kickbattle"
MaxHubs = 20
FunTable = {}
FunComp = {}
Reason = {}

function Main()
   frmHub:RegBot(Bot)
end

function DataArrival(user, data)
   if user.sMyInfoString and user.bOperator == nil then
      s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
      if thubs ~= nil then
         hubs = 0
         if tonumber(thubs) == nil then
            gsub(thubs, "(%d+)", function (num)
            hubs = hubs +tonumber(num)
            end)
         else
            hubs = tonumber(thubs)
         end
         if hubs >= MaxHubs then
            if FunTable[user.sName] == nil then
               SendToAll(Bot, user.sName.." was found in the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[user.sName] = 10
            end
         end
      end
   end
   if( strsub(data, 1, 1) == "<" ) then
      local s,e,num=strfind(data, "^%b<>%s+(%d+)")
      if tonumber(num) then
         num = tonumber(num)
         if num <= 10 then
            if FunComp[user.sName] == nil then
               FunComp[user.sName]=10
               if num == 10 then
                  FunComp[user.sName]= 9
                  for a,b in FunTable do
                     if num == b then
                        FunTable[a]=(b-1)
                     end
                  end
               end
            elseif num == (FunComp[user.sName]) then
               FunComp[user.sName]= FunComp[user.sName] -1
               for a,b in FunTable do
                  if num == b then
                     FunTable[a]=(b-1)
                     if FunTable[a] == -1 and FunComp[user.sName] == -1 then
                        local vic = GetItemByName(a)
                        FunTable[a]=nil
                        FunComp=nil
                        FunComp = {}
                        if vic then
                           SendToAll(Bot, user.sName.." is the lucky winner and kicked "..vic.sName.."!|")
                           if Reason[vic.sName] then
                              vic:SendPM(Bot, "your kicked for "..Reason[vic.sName]..", greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           else
                              vic:SendPM(Bot, "your kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           end
                           vic:Disconnect()
                        end
                     end
                  end
               end
            end
         end
      else
         data = strsub(data, 1, (strlen(data)-1))
         local s,e,num=strfind(data, "^%b<>%s+(%S+)")
         if num == "!abuser" and user.bOperator then
            local s,e,vic,why=strfind(data, "%b<>%s+%S+%s*(%S*)%s*(.*)")
            if vic == "" then
               user:SendData(Bot, "I need a user name!|")
               return 1
            elseif why == "" then
               user:SendData(Bot, "Sorry, need a reason!|")
               return 1
            elseif GetItemByName(vic) then
               if FunTable[vic] == nil then
                  SendToAll(Bot, vic.." has been named an abuser by "..user.sName.." for the following reason: "..why..", pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
                  FunTable[vic] = 10
                  Reason[vic]=why
                  return 1
               end
            else
               user:SendData(Bot, "Unknown user!|")
               return 1
            end
         end
      end
   end
end

function NewUserConnected(user)
   s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
   if thubs ~= nil then
      hubs = 0
      if tonumber(thubs) == nil then
         gsub(thubs, "(%d+)", function (num)
         hubs = hubs +tonumber(num)
         end)
      else
         hubs = tonumber(thubs)
      end
      if hubs >= MaxHubs then
         if FunTable[user.sName] == nil then
            SendToAll(Bot, user.sName.." has entered the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
            FunTable[user.sName] = 10
         end
      end
   end
end
plop
Title:
Post by: Odin on 21 April, 2004, 23:11:52
Weee, this is GREAT stuff :)

just one thing, its not compatible with deflood.lua
Users cant partisipate,  they get flood warnings (the flood bot removes numbers from chat).

so.. how bout using word's instead of numbers in this count down?
If U manage to pull random words from a text file this will be a real challenge!
And, if possible, ad a command to set numbers of words needed, so admins can rais the level of difficulty when the users improve their typing skills?
Title:
Post by: plop on 22 April, 2004, 15:33:02
QuoteOriginally posted by Odin
Weee, this is GREAT stuff :)

just one thing, its not compatible with deflood.lua
Users cant partisipate,  they get flood warnings (the flood bot removes numbers from chat).

so.. how bout using word's instead of numbers in this count down?
If U manage to pull random words from a text file this will be a real challenge!
And, if possible, ad a command to set numbers of words needed, so admins can rais the level of difficulty when the users improve their typing skills?
really cool idea, gone do it.

plop
Title:
Post by: ??????Hawk?????? on 26 April, 2004, 03:24:30
BOOT Added  :P


-- it anounces users who enter who are in more then the max hubs set.
-- after that the users have 2 count down from 10 to 0.
-- the fastest user gets the honor of the kick.
-- why?? because it's fun!
-- added bypase for op's
-- added command so op's can nominate users 2 (reason must be given)
-- Added A BOOT ??????Hawk??????

Bot = "public_kickbattle"
MaxHubs = 20
FunTable = {}
FunComp = {}
Reason = {}
speed = 200
Height = "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"..
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"..
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
Heighta = "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"..
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"..
"\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"
function Main()
   frmHub:RegBot(Bot)
SetTimer(speed)
end

function DataArrival(user, data)
   if user.sMyInfoString and user.bOperator == nil then
      s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
      if thubs ~= nil then
         hubs = 0
         if tonumber(thubs) == nil then
            gsub(thubs, "(%d+)", function (num)
            hubs = hubs +tonumber(num)
            end)
         else
            hubs = tonumber(thubs)
         end
         if hubs >= MaxHubs then
            if FunTable[user.sName] == nil then
               SendToAll(Bot, user.sName.." was found in the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[user.sName] = 10
            end
         end
      end
   end
   if( strsub(data, 1, 1) == "<" ) then
      local s,e,num=strfind(data, "^%b<>%s+(%d+)")
      if tonumber(num) then
         num = tonumber(num)
         if num <= 10 then
            if FunComp[user.sName] == nil then
               FunComp[user.sName]=10
               if num == 10 then
                  FunComp[user.sName]= 9
                  for a,b in FunTable do
                     if num == b then
                        FunTable[a]=(b-1)
                     end
                  end
               end
            elseif num == (FunComp[user.sName]) then
               FunComp[user.sName]= FunComp[user.sName] -1
               for a,b in FunTable do
                  if num == b then
                     FunTable[a]=(b-1)
                     if FunTable[a] == -1 and FunComp[user.sName] == -1 then
                        vic = GetItemByName(a)
                        FunTable[a]=nil
                        FunComp=nil
                        FunComp = {}
                        if vic then

BootUser = user.sName
StartTimer()
                           if Reason[vic.sName] then
                              vic:SendPM(Bot, "your kicked for "..Reason[vic.sName]..", greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           else
                              vic:SendPM(Bot, "your kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
                           end
                           vic:Disconnect()
                        end
                     end
                  end
               end
            end
         end
      else
         data = strsub(data, 1, (strlen(data)-1))
         local s,e,num=strfind(data, "^%b<>%s+(%S+)")
         if num == "!abuser" and user.bOperator then
            local s,e,vic,why=strfind(data, "%b<>%s+%S+%s*(%S*)%s*(.*)")
            if vic == "" then
               user:SendData(Bot, "I need a user name!|")
               return 1
            elseif why == "" then
               user:SendData(Bot, "Sorry, need a reason!|")
               return 1
            elseif GetItemByName(vic) then
               if FunTable[vic] == nil then
                  SendToAll(Bot, vic.." has been named an abuser by "..user.sName.." for the following reason: "..why..", pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
                  FunTable[vic] = 10
                  Reason[vic]=why
                  return 1
               end
            else
               user:SendData(Bot, "Unknown user!|")
               return 1
            end
         end
      end
   end
end

function NewUserConnected(user)
   s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
   if thubs ~= nil then
      hubs = 0
      if tonumber(thubs) == nil then
         gsub(thubs, "(%d+)", function (num)
         hubs = hubs +tonumber(num)
         end)
      else
         hubs = tonumber(thubs)
      end
      if hubs >= MaxHubs then
         if FunTable[user.sName] == nil then
            SendToAll(Bot, user.sName.." has entered the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
            FunTable[user.sName] = 10
         end
      end
   end
end

function OnTimer()
LoadBootText(vic, Height)
Height = strsub(Height, 1, (strlen(Height)-4))
if Height == "" then
LoadBootTexta()
SendToAll(Bot,BootText.."  "..BootUser.." is the lucky winner and kicked "..vic.sName.."!|")
StopTimer()
else
SendToAll(Bot,BootText)
end
end

function LoadBootText(vic)
BootText = Heighta.."____\r\n"..
"[=--=/\r\n"..
"}  :(___.--.\r\n"..
"(    __ '    )\r\n"..
"'===='''----'        "..
Height.."\r\n"..vic.sName
end

function LoadBootTexta()
BootText = Heighta.."____\r\n"..
"[=--=/\r\n"..
"}  :(___.--.\r\n"..
"(    __ '    )\r\n"..
"'===='''----'        "
end


Title:
Post by: yepyepyep4711 on 26 April, 2004, 14:24:01
cool Hawk. : )
If you're working on this a well, maybe you could solve the following problem: if someone doesn't get kicked (because they leave the hub before the countdown is done), the next abuser doesn't get kicked (the script is still stuck on the last one that wasn't kicked).

cheers
Title:
Post by: ??????Hawk?????? on 26 April, 2004, 18:43:34
hmmm  i cant seem to replicate it here but try this .  it should clear all tables after every kick.


can't put it here because of the forum adding extra  

'  & quot;  '  on some of the lines ..  


Title:
Post by: yepyepyep4711 on 26 April, 2004, 22:46:49
sounds great.

I'm realising users get irritated if the script doesn't say anything (because the victim already got out). It would be great if it said something like "userxxx won the kickbattle but victimyyy ran away in fear! ;-)"

can you do that?

thy already and cheers
Title:
Post by: ??????Hawk?????? on 26 April, 2004, 23:39:56
try this m8  ...



can't put it here because of the forum adding extra  

'  & quot;  '  on some of the lines ..  


Title:
Post by: yepyepyep4711 on 27 April, 2004, 14:41:23
Hi Hawk, I've now tried you boot versions, all of them, and I get the following error:

Syntax error: expected;
  last token read: `&' at line 29 in file `...X\test Versions\0.330.b15.25.dbg\scripts\public_kickbattle.orig.lua'
Title:
Post by: yepyepyep4711 on 28 April, 2004, 01:38:29
since Hawk can't post his version, I'll post mine, it has one extra (bot desc, speed, etc...) and correct english ;p

Hawk helped me strip his version from the boot animation as well, so this one only prints the boot once.


-- public_kickbattle by plop
-- it announces users who enter who are in more than the max hubs set.
-- after that the users have 2 count down from 10 to 0.
-- the fastest user gets the honor of the kick.
-- why?? because it's fun!
-- added bypass for op's
-- added command so op's can nominate users 2 (reason must be given)
-- Added A BOOT ??????Hawk??????
-- added bot email, speed, desc and share from a bot I had lying around -- yepyepyep4711

gb = 1024 * 1024 * 1024

--- you can change these

Bot = "public_kickbattle"
bot_email = "kick@yours.com"
bot_speed = "4711 kbs"
bot_descr = "behold the mighty boot"
bot_share_size = 47.11 * gb
MaxHubs = 47

--- don't change anything further below

FunTable = {}
FunComp = {}
Reason = {}
function Main()
   frmHub:RegBot(Bot)
   my_info_string = "$MyINFO $ALL "..Bot.." "..bot_descr.."$ $"..bot_speed..strchar( 1 ).."$"..bot_email..
"$"..bot_share_size.."$"
end

function DataArrival(user, data)


   if user.sMyInfoString and user.bOperator == nil then
      s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
      if thubs ~= nil then
         hubs = 0
         if tonumber(thubs) == nil then
            gsub(thubs, "(%d+)", function (num)
            hubs = hubs +tonumber(num)
            end)
         else
            hubs = tonumber(thubs)
         end
         if hubs >= MaxHubs then
            if FunTable[user.sName] == nil then
OfflineBootNick = user.sName
               SendToAll(Bot, user.sName.." was found in the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
               FunTable[user.sName] = 10
            end
         end
      end
   end
   if( strsub(data, 1, 1) == "<" ) then
      local s,e,num=strfind(data, "^%b<>%s+(%d+)")
      if tonumber(num) then
         num = tonumber(num)
         if num <= 10 then
            if FunComp[user.sName] == nil then
               FunComp[user.sName]=10
               if num == 10 then
                  FunComp[user.sName]= 9
                  for a,b in FunTable do
                     if num == b then
                        FunTable[a]=(b-1)
                     end
                  end
               end
            elseif num == (FunComp[user.sName]) then
               FunComp[user.sName]= FunComp[user.sName] -1
               for a,b in FunTable do
                  if num == b then
                     FunTable[a]=(b-1)
                     if FunTable[a] == -1 and FunComp[user.sName] == -1 then
                        vic = GetItemByName(a)
                        FunTable[a]=nil
                        FunComp=nil
                        FunTable = {}
FunComp = {}
                        if vic then
BootUser = user.sName
                           if Reason[vic.sName] then
                              vic:SendPM(Bot, "you're kicked for "..Reason[vic.sName]..", greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
KickBoot()
                           else
                              vic:SendPM(Bot, "you're kicked for the insane amount of hub's your in, greets from the users of this hub! specialy from "..user.sName.." as he won the battle.|")
KickBoot()
                           end
                        else
BootUser = user.sName
KickBoot()
                        end
                     end
                  end
               end
            end
         end
      else
         data = strsub(data, 1, (strlen(data)-1))
         local s,e,num=strfind(data, "^%b<>%s+(%S+)")
         if num == "!abuser" and user.bOperator then
            local s,e,vic,why=strfind(data, "%b<>%s+%S+%s*(%S*)%s*(.*)")
            if vic == "" then
               user:SendData(Bot, "I need a user name!|")
               return 1
            elseif why == "" then
               user:SendData(Bot, "Sorry, need a reason!|")
               return 1
            elseif GetItemByName(vic) then
               if FunTable[vic] == nil then
OfflineBootNick = vic
                  SendToAll(Bot, vic.." has been named an abuser by "..user.sName.." for the following reason: "..why..", pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
                  FunTable[vic] = 10
                  Reason[vic]=why
                  return 1
               end
            else
               user:SendData(Bot, "Unknown user!|")
               return 1
            end
         end
      end
   end
end

function NewUserConnected(user)

   user:SendData( my_info_string )

   s,e,thubs=strfind(user.sMyInfoString, "H:([%d%/]+)")
   if thubs ~= nil then
      hubs = 0
      if tonumber(thubs) == nil then
         gsub(thubs, "(%d+)", function (num)
         hubs = hubs +tonumber(num)
         end)
      else
         hubs = tonumber(thubs)
      end
      if hubs >= MaxHubs then
         if FunTable[user.sName] == nil then
            SendToAll(Bot, user.sName.." has entered the hub while he's in "..hubs.." hubs, pls countdown down from 10 to 0 and you could be the one to kick his ass!!|")
            FunTable[user.sName] = 10
         end
      end
   end
end

function OpConnected(curUser)
   curUser:SendData( my_info_string )
end

function KickBoot()
LoadBootText()
if GetItemByName(OfflineBootNick) == nil then
   SendToAll(Bot,BootText.."  "..BootUser.." is the lucky winner but "..OfflineBootNick.." has already run away!|")
else
   SendToAll(Bot,BootText.."  "..BootUser.." is the lucky winner and kicked "..vic.sName.."!|")
   vic:Disconnect()
end

end

function LoadBootText()
BootText = "\r\n"..
"____\r\n"..
"[=--=/\r\n"..
"}  :(___.--.\r\n"..
"(    __ '    )\r\n"..
"'===='''----'        "..
"\r\n"..OfflineBootNick
end
Title: Animated Boot
Post by: ??????Hawk?????? on 28 April, 2004, 01:53:37
ok seems this is the only way i can share it


Click Here to d/l the animated version (http://www.hubs-inc.net/download.php?id=8)