Here is an example of how we do our account based flagging system over at NL, I'd post the actual context we use, but its basically proprietary to our system.
Code:
sub EVENT_SAY {
my $t = $client->AccountID();
my $globalname = "$t";
if ($text =~/hail/i) {
plugin::whisper("$t");
}
if ($text =~/account/i) {
quest::setglobal("$t",1,7,'F');
quest::say("Flag set");
}
if (defined $qglobals{$globalname}) {
if ($qglobals{$globalname} == 1) {
if ($text =~/test/i) {
plugin::Whisper("You are Account Flagged");
}
}
}
}