This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

User Level checking

Old posts that have not been replied to for several years.
Locked
W
Weirdo
Master
Posts: 265
Joined: Sat Apr 27, 2002 8:00 pm
Location: Manchester, England

User Level checking

Post by Weirdo »

I have a public, random insult, kick script to be used for Rule Breaches. Problem is, registered users that are +o, can kick masters and owners, and voices can do that when i set the pub bind to listen to them

Is there a way that i can do the sort of checking to prevent people from nuking other people that have higher access than them?

Was thinking of setting user level with a number, and using:


If user is Greater than your user level, than you cant kick. If they are lower or equal to you, itll kick
s
spock
Master
Posts: 319
Joined: Thu Dec 12, 2002 8:40 pm

Post by spock »

just use a few if statements and 'matchattr'
no point in re-inventing the wheel
photon?
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This seems a little tricky to do.

You can use XTRA fields, and store yur number, then do checking that way, however, it's another set of permissions to monitor. What if you drop a master down to voice, but foeget the permissions. Bad move.

You can tyr this, though there is certainly no gurentee it will work. You pass it the handle of the person attmepting the kick (available from the arguemnts passed), the vistims handle (Use hand2nick) and the channel this is happening on. I did it this way, because I can't be bothered with conversions myself.

Code: Select all

proc checklevel {hand victim chan} {
  if {($hand == "*") && ($victim == "*")} { return 0 }
  if {($hand == "*") && ($victim != "*")} { return -1 }
  if {($hand != "*") && ($victim == "*")} { return 1 }
  set v "0"
  set h "0"
  if {[matchattr $victim "n"]} { incr v 20000 }
  if {[matchattr $victim "|n" $chan]} { incr v 10000 }
  if {[matchattr $victm "m"]} { incr v 2000 }
  if {[matchattr $victim "|m" $chan]} { incr v 1000}
  if {[matchattr $victim "o"]} { incr v 200 }
  if {[matchattr $victim "|o" $chan]} { incr v 100 }
  if {[matchattr $victim "v"]} { incr v 2 }
  if {[matchattr $victim "|v" $chan]} { incr v 1 }
  if {[matchattr $hand "n"]} { incr h 20000 }
  if {[matchattr $hand "|n" $chan]} { incr h 10000 }
  if {[matchattr $hand "m"]} { incr h 2000 }
  if {[matchattr $hand "|m" $chan]} { incr h 1000}
  if {[matchattr $hand "o"]} { incr h 200 }
  if {[matchattr $hand "|o" $chan]} { incr h 100 }
  if {[matchattr $hand "v"]} { incr h 2 }
  if {[matchattr $hand "|v" $chan]} { incr h 1 }
  return [expr $h - $v]
}
Note, this is not very complex, but the thought is.It would need lailoring to the way you use permissions.

IE, is a global voice, higher than a channel OP. In my channels, no, bu many would consider it

It will return a number, based on who has what. If the number is negative, the victim has more permissions that the kicker. If it's possative, the kicker has more permissions. If it is 0, then they are equal.

People that are not added to the bot, are considered as having no permissions. Thus, even if they are added, but have no flags, they are considered as having at least some permission. If neither are added to the bot, they are considered equal. If only one of the 2 has a record, but no flags, they are considered as having more permission.

Note, the number space between OP and Voices. This will allow you add "Helper" based permissions too. I don't know the flag, and can't be bothered.
Locked