PtokaX forum

Archive => Archived 4.0 boards => Help with Lua 4 scripts => Topic started by: DorianG on 29 February, 2004, 15:06:56

Title: Please help me with this script
Post by: DorianG on 29 February, 2004, 15:06:56
I want to make a nick ban command, but I would want that an operator that uses this command, don't can ban users that are a part of these profile: 5, 6 and 0..
I have writen this code but don't work well..
If anybody helps me he would do me a favor :)


function Boom(user, data)
s,e,cmd,str,msg = strfind(data, "%b<>%s+(%S+)%s+(%S+)%s+(%S+)")
local usr = GetItemByName(str)
if usr.iProfile == "5" or usr.iProfile == "6" or usr.iProfile == "0" then
user:SendPM(Bot, "You are not allowd to kick  "..str)
else
local usr = GetItemByName(str)
SendPmToNick(str, Bot, "You are being kicked by "..user.sName.." because:  " ..msg)
usr:NickBan()
SendToOps(Bot, "The user   "..str.." is kicking by  "..user.sName.." because:  " ..msg)
end
end
Title:
Post by: NightLitch on 29 February, 2004, 15:55:11
maybe this works:

function Boom(user, data)
s,e,str,msg = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(.*)")
local usr = GetItemByName(str)
if usr.iProfile == "5" or usr.iProfile == "6" or usr.iProfile == "0" then
user:SendPM(Bot, "You are not allowd to kick  "..usr.sName)
else
SendPmToNick(usr.sName, Bot, "You are being kicked by "..user.sName.." because:  " ..msg)
SendToOps(Bot, "The user   "..usr.sName.." is kicking by  "..user.sName.." because:  " ..msg)
usr:NickBan()
end
end

/NL
Title:
Post by: DorianG on 29 February, 2004, 16:07:24
I have tried but the problem is always the usual. If I enter like user of 5 level and I ban a user of 6 level, the bot doesn't stop me but ban he..
Idem if i enter with an other level user..

My users profile..

0|Master|10001111110111111100111000000001
1|Operator|10000100010001111100110000000001
2|VIP|10000000000001111000000000000000
3|Reg|10000000000000000000000000000000
4|Mod|10000110110111111100111000000001
5|Admin|10001111110111111100111000000001
6|Owner|10001111110111111100111000000001
Title:
Post by: NightLitch on 29 February, 2004, 16:17:32
did understand you english to well but trie this then:

function Boom(user, data)
s,e,str,msg = strfind(data, "%b<>%s+%S+%s+(%S+)%s+(.*)")
local usr = GetItemByName(str)
if usr.iProfile == 5 or usr.iProfile == 6 or usr.iProfile == 0 then
user:SendPM(Bot, "You are not allowd to kick  "..usr.sName)
else
SendPmToNick(usr.sName, Bot, "You are being kicked by "..user.sName.." because:  " ..msg)
SendToOps(Bot, "The user   "..usr.sName.." is kicking by  "..user.sName.." because:  " ..msg)
usr:NickBan()
end
end

the problem was this:

you had:

if usr.iProfile == "5" or usr.iProfile == "6" or usr.iProfile == "0" then

this is how it should look like:

if usr.iProfile == 5 or usr.iProfile == 6 or usr.iProfile == 0 then
Title:
Post by: DorianG on 29 February, 2004, 17:03:39
oh yes :) good work and thank you very much :)