i have a migraine, so i decided to share.
plugins\client_first.pl
Code:
use Scalar::Util qw(blessed);
# insert missing $client object as first parameter passed to subroutine
# usage: @_ = plugin::ClientFirst(@_);
sub ClientFirst
{
unshift(@_, plugin::val('$client'))
if ((blessed($_[0]) // '') ne 'Client');
@_;
}
example usage (in plugins\check_hasitem.pl):
Code:
#checks to see if player has item
#useage plugin::check_hasitem($client, itemid);
sub check_hasitem
{
@_ = plugin::ClientFirst(@_);
my $client = shift;
my $itmchk = shift;
# yada yada
...;
}
with this addition, either of these would be valid:
Code:
my $found = plugin::check_hasitem($client, $itemid);
my $found = plugin::check_hasitem($itemid);