That quest error is just because the timer is triggering and the npc doesn't have a target. So $targetname is uninitialized.. and comparing it to another value is a warning.
Change to... if you don't want to see the error a bunch of times
Code:
if ($npc->GetTarget() && $targetname=~/highway_bandit/i) {
$npc->WipeHateList();
}