DaPigGuy / libPiggyEconomy

A PocketMine-MP virion for easy support of multiple economy providers.
Apache License 2.0
10 stars 8 forks source link

I need help #9

Closed ClickedTran closed 1 year ago

ClickedTran commented 1 year ago

Why can't I use getMoney($player) ?

My Code:

.....function myCodeGUI(InvMenuTransaction $action) : InvMenuTransactionResult{
$player = $action->getPlayer();
$price = 1000;
if(MyPlugin::getInstance()->getMoney($player) >= $price){
   //Everything
}else{
   //Everthing2
}

Error:

Too few arguments to function DaPigGuy\libPiggyEconomy\providers\EconomySProvider::getMoney(), 1 passed in /storage/emulated/0/Android/data/com.kpwnapps.pmmpplugins/files/PocketMine-MP/plugins/MyPlugin/src/ClickedTran/MyPlugin/gui/GUIManager.php on line 199 and exactly 2 expected

Tell me how to fix it, please 😭

Aericio commented 1 year ago

You are missing the callback function.

See this for an example. https://github.com/DaPigGuy/PiggyFactions/blob/1c2c73f6763f166160d5e1fe7594a0678c9a3d5c/src/DaPigGuy/PiggyFactions/commands/subcommands/money/DepositSubCommand.php#L21-L35