PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: plop on 10 May, 2004, 22:11:31

Title: VIP vote kick
Post by: plop on 10 May, 2004, 22:11:31
was asked 2 make this script for a hub.
with it VIP's can kick but only if x VIP's vote the user 2 be kicked.
-- VIP vote kick by plop
--

Bot = "fikkie"
cAmountKick = 2  -- amount of votes needed for the kick (2 is the minimum)
tToBeKicked = {} -- counting the votes
tKickers = {} -- making sure they can't vote double

function Main()
   frmHub:RegBot(Bot)
end

function DoKick(user, victum)
   if victum == "" then
      return "I need a name to know who to kick!!"
   else
      local victem = GetItemByName(victum)
      if victem ~= nil then
         if victem.iProfile == 3 or victem.iProfile == -1 then
            if tToBeKicked[victem.sName] then
               if tKickers[victem.sName][user.sName] then
                  return "You allready voted to kick "..victum.."!"
               else
                  tToBeKicked[victem.sName] = tToBeKicked[victem.sName] + 1
                  if tToBeKicked[victem.sName] >= cAmountKick then
                     tToBeKicked[victem.sName] = nil
                     tKickers[victem.sName] = nil
                     SendToAll(Bot, "Enough VIP's have voted to kick "..victem.sName.."!|")
                     victem:Kick("Enough VIP's have voted to get you kicked!")
                     return vic.." has been kicked"
                  else
                     tKickers[victem.sName][user.sName] = 1
                     return "Your vote to kick "..victum.." has been processed!"
                  end
               end
            else
               tToBeKicked[victem.sName] = 1
               if tKickers[victem.sName] == nil then
                  tKickers[victem.sName] = {}
               end
               tKickers[victem.sName][user.sName] = 1
               return "Your vote to kick "..victum.." has been processed!"
            end
         else
            return "We don't kick Operators or VIP's!!"
         end
      else
         return victum.." Isn't in the hub!!"
      end
   end
end


function DataArrival(user, data)
   if user.iProfile == 2 then
      if(strsub(data, 1, 4) == "$To:") then
         local s,e,whoTo = strfind(data,"$To:%s+(%S+)")
         if whoTo == Bot then
            data=strsub(data,1,strlen(data)-1)
            local s,e,cmd = strfind(data, "%$%b<>%s+(%S+)")
            if cmd == "!kick" then
               local s,e,victum = strfind(data, "%$%b<>%s+%S+%s*(%S*)")
               user:SendData(Bot, DoKick(user, victum).."|")
               return 1
            end
         end
      elseif( strsub(data, 1, 1) == "<" ) then
         data=strsub(data,1,strlen(data)-1)
         local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
         if cmd == "!kick" then
            local s,e,victum = strfind(data, "%b<>%s+%S+%s*(%S*)")
            user:SendData(Bot, DoKick(user, victum).."|")
            return 1
         end
      end
   end
end
plop
Title:
Post by: honda on 11 May, 2004, 13:53:16
NIce script and very help full after the last discussion we have about vips ;-)

Greeting
Title:
Post by: plop on 11 May, 2004, 21:43:45
QuoteOriginally posted by honda
NIce script and very help full after the last discussion we have about vips ;-)

Greeting
it's a nice diplomatic way 2 let vips do some kicking. lol
they can kick but it's hard 2 cause a bad kick because of the voting.

plop
Title:
Post by: psf8500 on 12 May, 2004, 00:36:31
Hehe. loving this script. btw "procest" should be "processed".

Had a good suggestion for something similar. An op types something like !userkick

Then users get 30 seconds or something to vote if they think that user should be kicked (the users have to type !votekick or whatever)

Give the users a chance to do a bit of kicking ;-)

Any chance of that plop?
Title:
Post by: plop on 12 May, 2004, 18:41:18
QuoteOriginally posted by psf8500
Hehe. loving this script. btw "procest" should be "processed".

Had a good suggestion for something similar. An op types something like !userkick

Then users get 30 seconds or something to vote if they think that user should be kicked (the users have to type !votekick or whatever)

Give the users a chance to do a bit of kicking ;-)

Any chance of that plop?
fixed the spelling error, thx.
and for that other request take a look here (http://board.univ-angers.fr/thread.php?threadid=1650&boardid=12&styleid=1).
they don't have 30 seconds but need 2 count from 10 to 0.
the fastest does the kick.

plop
Title:
Post by: deeq on 13 May, 2004, 16:41:29
Now 2 vote and kick..How i change 3 vote and kick?
Title:
Post by: plop on 13 May, 2004, 19:08:46
QuoteOriginally posted by deeq
Now 2 vote and kick..How i change 3 vote and kick?
change this line.
cAmountKick = 1

the current minimum is 2 votes.

plop
Title:
Post by: Reefa on 23 June, 2004, 15:07:07
Hi Plop :)

Is it possible to put in a timer, so the VIPs only have two minutes to vote and then the vote is cancelled and they have to start again?

Thanks ;)
Title: votekick on BCDC
Post by: Appel on 20 August, 2004, 16:10:00
Hi guys,

I know that the favour I am going to ask is huge. But I try...

We run our hub on Linux, using Verlihub. We like the idea of a votekick bot for VIP users, and would like to ask you to help altering this script for BCDC.  The users eligible to vote via votekick bot would be registered in the bot by an OP. It has nothing to do with VIP levels in Verlihub. An OP could type, for instance, !regvote 'username', and that sets that user eligible to use the bot untill an OP inputs  !delregvote 'username'. (!listreg is also helpful) Users registered to votekick can enter !votekick 'baduser', (up to the voter's choice, either in main chat so it is visible for 'baduser' and might stop him, or in PM, so the voter remain anonymous). After a given number (probabaly 2) of votes for 'baduser', he gets kicked, with a preset message, like "VIP users have voted you out of this hub. Please keep our rules and behave friendlier" A record on votes might be useful for OPs, but not necesarry.

Any of you feel like coding such a script? Maybe plop? I would highly appreciate it, really.
Thx.