Quote:
Originally Posted by Maceblade
H you were correct, only issue im having is that 1 person can bang out all 10 hails.
|
Mace, I came up with a quick example for you - the count part was a simple mistake because I was thinking of something different before I got to the below section (quickly) but simply illustrating what you can do.
To limit 1 per person, you have to add additional checking. In this case I would create a character scoped (Type 5) qglobal to keep folks from being able to hail more than once from their character:
Code:
sub EVENT_SAY{
if(!defined($qglobals{"TenTimeEvent"})){ $client->SetGlobal("TenTimeEvent", "10", 7, 'F'); }
my $CountToZero = ($qglobals{"TenTimeEvent"} - 1);
if($text=~/hail/i){ quest::say("The fuck you want?"); $client->Message(15, quest::saylink("Make me a sammich", 1)); }
if($text=~/sammich/i){
if($qglobals{"TenTimeEventChar"} == 1){
quest::say("You already got your reward!");
}
elsif($qglobals{"TenTimeEvent"} > 0){
quest::say("WHAT?! Fine... But I will only do it " . $CountToZero . " more time(s)...");
$npc->SetGlobal("TenTimeEvent", ($qglobals{"TenTimeEvent"} - 1) , 7, 'F');
$client->SetGlobal("TenTimeEventChar", 1 , 5, 'F');
}else{
quest::say("Sorry man, I told you I wouldn't make you a sammich anymore...");
}
}
}
I really suggest you read up on qglobals - they can be used often.
