PtokaX forum

Archive => Archived 5.0 boards => Request for scripts => Topic started by: Jaakko on 10 July, 2006, 15:20:22

Title: Set & show redirect(s)
Post by: Jaakko on 10 July, 2006, 15:20:22
My profiles are Admin, Master, Opertaor, Vip and Reg.
Admin and Master profiles would need to see where the share redirect and full hub redirect are going to and change them (if needed).
Thank you in advance.
P.S. My full & share redirects allways go to the same address so there is no need for four commands.
Title: Re: Set & show redirect(s)
Post by: Madman on 25 July, 2006, 19:51:31

-- SeeSet Redirect
-- Made by Madman, 06-07-25
-- Requested by Jaakko

CanRule = { -- Can set/set redirects
[0] = 1, -- Masters
[1] = 0, -- Ops
[2] = 0, -- Vips
[3] = 0, -- Reg
[4] = 0, -- Custom profile
[5] = 0, -- Custom profile 2
}

-- The cmd's, prefix not needed, support for ! + ? # scripted
SeeCmd = "seer"
SetCmd = "setr"

function ChatArrival(curUser, data)
local data = string.sub(data, 1, -2)
if CanRule[curUser.iProfile] == 1 then
local s,e,cmd = string.find(data, "%b<>%s+[%!%+%?%#](%S+)")
if cmd == SeeCmd then
curUser:SendData(frmHub:GetHubBotName(), "Redirect address: " ..frmHub:GetRedirectAddress() .. " , Share Redirect address: " ..frmHub:GetShareRedirAddr()) return 1
elseif cmd == SetCmd then
local s,e,NewAddress = string.find(data, "%b<>%s+%S+%s+(%S+)")
if NewAddress then
frmHub:SetRedirectAddress(NewAddress)
frmHub:SetShareRedirAddr(NewAddress)
curUser:SendData(frmHub:GetHubBotName(), "New redirect adress set to " ..frmHub:GetRedirectAddress())
else
curUser:SendData(frmHub:GetHubBotName(), "Syntax: !" ..SetCmd.. " <NewAddress>")
end
return 1
end
end
end


This should do what you want. If i understood you right...
Script is set to allow only masters, but just change CanRule to allow diff. profiles.
Admin has nr 4 (most likely anyway).