Hello! This is my first post and i need some help to integrate a fully functional player reward system into a mini game plugin. I want to know if it's possible to do it simply with a few lines of code or if i would need to remake the mini game code, having not much experience with php this would be hard to do.. This is why i came here For example if a player wins the game the game would pay them say 1000 coins or an item reward. The game already tells the player that they won if that helps. If someone could help or guide me with this i would really appreciate it. If you need the mini game code i will email it to you :3 Thanks, MC ATECH.
It used to be, however it no longer is. (I did not create the plugin). I can still send the files to you if you need them
https://github.com/BlockHorizons/FactionsPE/blob/reborn/src/factions/FactionsPE.php#L243-L266 Economizer
So could I use the code highlighted in the factionspe plugin simply by copying and pasting the code into the source code of the minigame plugin? Will that work for what I need it to do?
No. Copying and Pasting will always cause more issues than it resolves, especially if you don't know what you are doing. I believe he was just giving an example for whoever wants to fill the request.
So is this possible :3 I will give it a blast tomorrow I've just been too busy the past day with work :/
I've managed to make the code to teleport a player back to the spawn and to clear there inventory but im struggling with adding in a reward system. code: PHP: $pl->sendMessage($this->prefix . TextFormat::GREEN . " You won!");$spawn = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn();$this->plugin->getServer()->getDefaultLevel()->loadChunk($spawn->getX(), $spawn->getZ());if ($pl->isOnline()) { $pl->teleport($spawn, 0, 0); $pl->getInventory()->clearAll();
Could I add in an edited version of for a winner? Maybe do this with another variable? if($cmd->getName() == "test"){ $sender->getInventory()->addItem(Item::get(364,0,2)); //364 = Item ID Value (in this case, 364 is steak) $sender->sendMessage(TextFormat::BOLD."You have just recieved 4 steak!"); } return true;
boi, PHP: $pl->sendMessage(TextFormat::GRAY . "==============================");$pl->sendMessage(TextFormat::GREEN . " ");$pl->sendMessage(TextFormat::YELLOW . TextFormat::BOLD . " You have won the match");$pl->sendMessage(TextFormat::AQUA . " 100 coins reward!");$pl->sendMessage(TextFormat::GREEN . " ");$pl->sendMessage(TextFormat::GRAY . "==============================");$spawn = $this->plugin->getServer()->getDefaultLevel()->getSafeSpawn();$this->plugin->getServer()->getDefaultLevel()->loadChunk($spawn->getX(), $spawn->getZ());if ($pl->isOnline()) { $pl->teleport($spawn, 0, 0); $pl->getInventory()->clearAll(); $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->addMoney($pl->("100")); sexy msg and reward XD