Getting $client in a timer in most cases will not happen cause a timer is not triggered by the client. Is these cases you have to store the client in another variable or qglobal. I have the common types below, but there are many other ways of doing this too.
Code:
sub EVENT_SPAWN {
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 20, $x + 20, $y - 20, $y + 20);
quest::settimer("testclient",5);
}
sub EVENT_SAY {
if($text=~/hail/i)
{$firstclient = $client;}
}
sub EVENT_AGGRO {
$secondclient = $client;
}
sub EVENT_COMBAT {
$thirdclient = $client;
}
sub EVENT_ENTER {
$fourthclient = $client;
}
sub EVENT_ENTERZONE {
$fifthclient = $client;
}
sub EVENT_TIMER {
if ($timer eq "testclient") {
if ($firstclient != 0)
{$cone = $firstclient->GetName();}
if ($secondclient != 0)
{$ctwo = $secondclient->GetName();}
if ($thirdclient != 0)
{$cthree = $thirdclient->GetName();}
if ($fourthclient != 0)
{$cfour = $fourthclient->GetName();}
if ($fifthclient != 0)
{$cfive = $fifthclient->GetName();}
quest::say("$cone");
quest::say("$ctwo");
quest::say("$cthree");
quest::say("$cfour");
quest::say("$cfive");
}
}