Page 1 of 1

Use donate plugin for payments to players

Posted: 06 Jun 2020, 18:52
by thepadawan
Hi,

I'm trying to write a small lottery plugin that pays a random amount of planets to a random player at the end of each map (very similar to lottery plugins for older ASECO's).

For the payment I want to use the plugin.donate.php, which should be able to make a payment from the server to a player (according to the description). But my attempt crashed UASECO (unfortunately I don't get any error messages).

I'm adding the dependence in the constructor: $this->addDependence('PluginDonate', Dependence::REQUIRED, '1.0.0', null);
And I'm trying to use the plugin like this: $aseco->plugins['PluginDonate']->admin_payment($aseco, $aseco->server->login, $targetLogin, $amountPlanets);

($targetLogin = login of the player who won the lottery)

I'm still new to PHP and I couldn't find any help on how to use the donate plugin to make a payment from the server. Thank you in advance.

Cheers,
Padawan

Re: Use donate plugin for payments to players

Posted: 28 Jun 2020, 20:45
by undef.de
You should use the pay method instead of the DonatePlugin: https://www.uaseco.org/dedicated-server/methods.php#Pay

Code: Select all

$billid = $aseco->client->query('Pay', 100, $login, $label);

Re: Use donate plugin for payments to players

Posted: 30 Jun 2020, 17:46
by thepadawan
Thank you. That does the job! :)

I'm not sure if you confused the arguments. At least I used it like this:

Code: Select all

$billid = $aseco->client->query('Pay', $login, 100, $label);

Re: Use donate plugin for payments to players

Posted: 30 Jun 2020, 18:26
by w1lla
thepadawan wrote:
30 Jun 2020, 17:46
Thank you. That does the job! :)

I'm not sure if you confused the arguments. At least I used it like this:

Code: Select all

$billid = $aseco->client->query('Pay', $login, 100, $label);
That is the correct one.