PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Finished Scripts => Topic started by: speedX on 03 January, 2008, 17:40:08

Title: Stop Hub Script
Post by: speedX on 03 January, 2008, 17:40:08

-- Stop Hub Script [NEW API] [Strict] by speedX (04/01/08)

tSettings = {
  -- Bot Name
sBot = SetMan.GetString(21),

-- Hub Name
sHubName = SetMan.GetString(0),

-- Rightclick: Enable = true, Disable = false
sRC = true,

-- Commands
sStopHub = "stophub",

-- Closing Message
sMsg = "Hub Closing",

-- 1 = Allow ; 0 = Don't Allow
Levels = {
        [-1] = 0,       -- Unregistered User
        [0] = 1,        -- Master
        [1] = 0,        -- Operator
        [2] = 0,        -- Vip
        [3] = 0,        -- Registered User
        }
           
}

function OnStartup()
        Core.RegBot(tSettings.sBot,"","",true)
end

ChatArrival = function(User,Data)
if tSettings.Levels[User.iProfile] == 1 then
local _,_,cmd = string.find(Data, "%b<>%s%p([^|]*)")
if cmd and (cmd == tSettings.sStopHub) then
Core.SendPmToAll(tSettings.sBot,tSettings.sMsg)
Core.Shutdown()
return true
end
else
   Core.SendToNick(User.sNick,"<"..tSettings.sBot.."> You are not allowed to use this command.")
   return true
end
end

UserConnected = function(User)
if tSettings.Levels[User.iProfile] == 1 then
if tSettings.sRC then
Core.SendToNick(User.sNick,"$UserCommand 1 3 "..tSettings.sHubName.."\\Stop Hub$<%[mynick]> !stophub&#124;")
end
end
end
OpConnected = UserConnected
RegConnected = UserConnected