PtokaX forum

Archive => Archived 4.0 boards => Request for Lua 4 scripts => Topic started by: NemeziS on 26 September, 2004, 00:24:17

Title: Can't kick/ban/redirect/gag admin...
Post by: NemeziS on 26 September, 2004, 00:24:17
Hi!
Another request! I wanted a bot that will protect admin from kick/ban/redirect/gag (even by op). And to protect Ops from kick/ban/redirect/gag by users which profile is
below.
I already saw "can't kick admin" script here, but my PtokaX 0330 finds an error there. So who can make this individual script for me? :)
Title:
Post by: nErBoS on 26 September, 2004, 19:50:24
Hi,

Can you give me the syntax of that commands ??? (syntax = !kick )

Best regards, nErBoS
Title:
Post by: NemeziS on 28 September, 2004, 14:36:59
Of course!
Here you are:

!drop
!redir
!gag
!ungag
!ban  
Title:
Post by: enema on 28 September, 2004, 19:30:06
why just you dont use Robocop 7 or later and configure it youreself?
Title:
Post by: nErBoS on 28 September, 2004, 23:51:39
Hi,

Here is the script...

--## PROFILE PROTECTOR BOT
--## Requested by NemeziS
--## Made by nErBoS

sBot = "PP-Bot"

--## Only remove this array if your ptokax supports LUA 5 ##--
string = {
sub = strsub,
len = strlen,
find = strfind,
lower = strlower,
}
--## END of REMOVE ##--

arrCMD = {
["!drop"] = 1,
["!redir"] = 1,
["!gag"] = 1,
["!ungag"] = 1,
["!ban"] = 1,
["!nickban"] = 1,
["!banip"] = 1,
}

function Main()
frmHub:RegBot(sBot)
end

function DataArrival(user,data)
if (string.sub(data,1,1) == "<" or string.sub(data,1,5+string.len(sBot)) == "$To: "..sBot) then
data = strign.sub(data,1,string.len(data)-1)
s,e,cmd = string.find(data, "%b<>%s+(%S+)")
if (arrCMD[string.lower(cmd)] ~= nil) then
local s,e,nick = string.find(data, "%b<>%s+%S+%s+(%S+)")
if (nick ~= nil and CheckProfile(user,nick) ~= nil) then
user:SendPM(sBot, "You can't use the command "..cmd.." against the user "..nick)
return 1
end
end
end
end

function CheckProfile(user,nick)
if (GetItemByName(nick) ~= nil) then
nick = GetItemByName(nick)
if ((user.iProfile == 0 or user.bOperator) and nick.iProfile == 0) then
return 1
elseif (user.bOperator and not user.iProfile == 0 and (nick.bOperator or nick.iProfile == 2) then
return 1
end
end
return nil
end

Status of the script:

Master - can't use the commands against Masters
Operator - can't use the commands against OPs and VIPs

NOTE: This script should be in the first palce of your script list

Best regards, nErBoS