determinate determinate

Author Topic: kick all unregged users script  (Read 521 times)

0 Members and 1 Guest are viewing this topic.

Offline kammikaze

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
kick all unregged users script
« on: September 09, 2010, 08:57:23 am »
Hello, somebody knows a good script for ptokax 4.12 where you can kick all unregged users just like robocop has in older ptokax versions? thx already ;D

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: kick all unregged users script
« Reply #1 on: September 10, 2010, 02:28:50 am »
RoboWho?  :P

Here you are, hot off the presses...

Code: [Select]
--[[

    Kick Guest 1.0 LUA 5.1x [Strict][API 2]

    By Mutor        09/09/10

    Requested by kammikaze

    Kicks unregistered users by operator command.
    - Provides context menu command
    - Option for custom reason per kick


]]

-- "Botname" ["" = Default Hub Bot]
Bot = ""
-- Context Menu Title ["" = Hub Name]
Menu = ""
--Context Submenu Title ["" = Script Name]
SubMenu = ""
-- Kick Command
Cmd = "KickUr"
-- Reason for Kick
Reason = "Guests must leave the hub at this time"

OnStartup = function()
    Scp,Pfxs,Pfx = "Kick Guest 1.0","",""
    Set=function(a,v,h)
        if a == "" then if h then return SetMan.GetString(v) else return v end else return a end
    end
    Bot = Set(Bot,Core.GetHubSecAlias(),false)
    if Bot ~= SetMan.GetString(21) then Core.RegBot(Bot,"Hub Security","",true) end
    Menu = Set(Menu,0,true)
    SubMenu = Set(SubMenu,Scp,false)
    Pfxs = Set(Pfxs,29,true)
    Pfx = Set(Pfx,Pfxs:sub(1,1),false)
end

OpConnected = function(user,data)
    Core.SendToUser(user,"$UserCommand 1 3 "..Menu.."\\"..SubMenu..    "\\Kick Unregistered "..
    "Users$<%[mynick]> "..Pfx..Cmd.." %[line:Reason For Kick (Optional)]&#124;")
end

ChatArrival = function(user,data)
    if user.iProfile~= -1 and ProfMan.GetProfile(user.iProfile).tProfilePermissions.bIsOP then
        local _,_,pfx,cmd = data:lower():find("%b<> (["..SetMan.GetString(29).."])("..Cmd:lower()..")")
        if pfx and cmd then
            local _,_,rsn = data:find("^%b<> %p%a+ ([^|]+)|$")
            if not rsn then rsn = Reason end
            for _,usr in ipairs(Core.GetOnlineUsers(-1)) do Core.Kick(usr,Bot,Reason) end
            return true
        end
    end
end
« Last Edit: October 17, 2010, 11:33:50 pm by Mutor »
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline kammikaze

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: kick all unregged users script
« Reply #2 on: September 10, 2010, 08:48:25 am »
Thx Mutor, i still use old hubsoft, what works fine to me, but i want to try the new hubsoft ptokax 4.12 where not all scripts works good. This script is one off the last i needed, so im gonne try it out and will proberly work like all youre scripts. Many many thx for this and bless ;)

p.s. The script works perfect in: DiXBoT v2.1 Build 2987_PtokaX 0.4.1.2

Thx again Mutor ;)
« Last Edit: September 15, 2010, 09:35:38 pm by kammikaze »

Offline kammikaze

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: kick all unregged users script
« Reply #3 on: October 17, 2010, 10:12:24 am »
After a few weeks i use this script,i got a error in it, but the script stay working for 100 %. Maybe you can help me out getting the error away, this error i get: [03:42] Syntax ...\scripts\Kick Guest 1.0 LUA 5.1x [Strict][API 2].lua:46: attempt to index a nil value
I stop and restart the script, the error stay away for a while.
thx already,
Bless ;)

Offline Mutor

  • Global Moderator
  • Forum God
  • *****
  • Posts: 3 854
  • Karma: +395/-18
  • To err is human, to arr is pirate...
    • PxDev
Re: kick all unregged users script
« Reply #4 on: October 17, 2010, 11:35:15 pm »
The error stemmed from an unregistered user attempting the $Kick <nick> protocol command.
Bug fixed and script above, updated with the changes. Thanks for the report.
Respectfully,

Mutor

=-=-=-=-=-=-=-==-=-=-=
[ Ptokax Admins Hub ] Ptokax Help Hub
[ Mutor's Ptokax Archive Website ] Scripting Forum
[ Dynamic Downloads ] API 2
[ Microsoft IIS serving PxWeb 1.0d ] API 2
[ WebReg 1.1.2.0 ] Web Based Hub Reg

Offline kammikaze

  • Junior Member
  • **
  • Posts: 18
  • Karma: +0/-0
Re: kick all unregged users script
« Reply #5 on: October 18, 2010, 09:32:53 am »
Thx again Mutor ;)
bless

 

determinate determinate