Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1.     public function onCommand(CommandSender $player, Command $command, string $label, array $args) : bool {
  2.  
  3.    
  4.         if($command == "trade"){
  5.             if($player instanceof Player){
  6.  
  7.   if($player->getGamemode() !== 1){
  8. foreach($this->getConfig()->getAll() as $items)
  9. {
  10.    if($items !== null)
  11.    foreach($items as $item)
  12.    {
  13.       $exp = explode(":", $item);
  14.       $cost = $exp[1];
  15.       $id = $exp[0];
  16.          $cost = $exp[2];#цена
  17.  
  18.           $id = $player->getInventory()->getItemInHand()->getId();
  19.      
  20.          $count = $player->getInventory()->getItemInHand()->getCount();
  21.  
  22.          $meta = $player->getInventory()->getItemInHand()->getDamage();
  23.  
  24. $nam = $player->getName();
  25.       if($id == $exp[0] && $meta == $exp[1]){
  26.  
  27. $this->m->addMoney($nam, $count * $cost);
  28.          $player->getInventory()->removeItem(Item::get($id, $meta, $count));
  29. $o = $count * $cost;
  30.  
  31. $player->sendMessage("§6✎ §8[§6§oСкупщик§r§8]§6 →§8 (§7$nam§8),§f я купил у тебя твои предметы, §6$count шт. §fза §l§c$o $§r");
  32. }
  33.  
  34. }
  35.  
  36. }
  37. }
  38.  
  39. }
  40. }
  41. return true;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement