If the roll is what you said you get back five times what you put in.
Here you go:
Code:
sub EVENT_SAY
{
my $NPCNAME = $npc->GetCleanName();
if($text=~/hail/i)
{
$client->Message(315, "$NPCNAME whispers to you, 'Hey there $name, up for some gambling? Pick a number from 1-10 by saying \"number #\", give me some money and if you're lucky and I roll your number you will get back five times the amount of money you put in.'");
}
elsif($text=~/number ([0-9]+)/i)
{
$numbers{$name} = $1;
$client->Message(315, "$NPCNAME whispers to you, 'Ok, you picked $1... Hand me your bet and let me grab my dice...'");
}
}
sub EVENT_ITEM
{
my $NPCNAME = $npc->GetCleanName();
if(defined($numbers{$name}))
{
$client->Message(315, "$NPCNAME whispers to you, 'Ok, your bet is $platinum pp, $gold gp, $silver sp, $copper cp. Rolling my dice!'");
$client->Message(315, "$NPCNAME tosses his dice on the ground and looks at the number that comes up.");
$roll = int(rand(9)+0.5) + 1;
plugin::Whisper("The roll is $roll!");
if($roll == $numbers{$name})
{
quest::givecash($copper*5,$silver*5,$gold*5,$platinum*5);
}
else
{
$client->Message(315, "$NPCNAME whispers to you, 'Oh, too bad, you lose, oh well, let me know if you want to try again.'");
}
}
else
{
$client->Message(315, "$NPCNAME whispers to you, 'You have to pick a number first!'");
quest::givecash($copper, $silver, $gold, $platinum);
plugin::return_items(\%itemcount);
}
}