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.

verify if user(in argument) have flag

Old posts that have not been replied to for several years.
Locked
H
HecKel
Voice
Posts: 23
Joined: Wed Jan 19, 2005 3:50 pm
Location: Lisbon, Portugal

verify if user(in argument) have flag

Post by HecKel »

I want to verify if a user have one flag with a public comand like this:

Code: Select all

!haveflag user1 f
and the egg return something like true, or false.

tnks, HecKel
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind pub o !hasflag pub:hasflag

proc pub:hasflag {nick uhost hand chan text} {
  if {[llength $text] < 2} {
    putserv "NOTICE $nick :Usage: !hasflag <user> <flag>"
    return
  }
  if {[validuser [set user [lindex [split $text] 0]]]} {
    if {[matchattr $user [set flag [lindex [split $text] 1]]]} {
      putserv "NOTICE $nick :User $user has $flag flag."
      } else {
      putserv "NOTICE $nick :User $user dosen't have $flag flag."
    }
    } else {
    putserv "NOTICE $nick :User $user is not a known user to me."
  }
}
Once the game is over, the king and the pawn go back in the same box.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

I would suggest using this instead:

Code: Select all

bind pub o !hasflag pub:hasflag

proc pub:hasflag {nick uhost hand chan text} {
  if {[llength $text] < 2} {
    putserv "NOTICE $nick :Usage: !hasflag <user> <flag>"
    return
  }
  set vhandle [nick2hand [set user [lindex [split $text] 0]]]
  if {![validuser $user]} {
    putserv "NOTICE $nick :User $user is not a known user to me."
    return 0
  }
    if {[matchattr $user [set flag [lindex [split $text] 1]]]} {
      putserv "NOTICE $nick :User $user has $flag flag."
      } else {
      putserv "NOTICE $nick :User $user dosen't have $flag flag."
    }
  }
} 
Else the person would have to have the exact same nickname as his handle is if i'm not mistaken, now, it will find him by hand :p
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

What about channel flags ?
Locked