Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

I want to edit a KillMoney plugin please help me!

Comments in 'Plugin Development' started by S3nS3IW00, Dec 20, 2016.

?

How can I fix it?

  1. Fix

    1 vote(s)
    100.0%
  2. Complite

    0 vote(s)
    0.0%
  1. S3nS3IW00
    Offline

    S3nS3IW00 New Member

    Joined:
    Dec 20, 2016
    Posts:
    3
    Minecraft User:
    S3nS3IW00
    I want to add a Takemoney syntax if the player is death, i try but its don't work, please complite for me, thanks!
    Their is the PHP code:
    PHP:
    <?php

    namespace KillMoney;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\utils\TextFormat;
    use 
    pocketmine\event\player\PlayerDeathEvent;
    use 
    pocketmine\event\entity\EntityDamageByEntityEvent;
    use 
    pocketmine\Player;

    class 
    Main extends PluginBase implements Listener{
       
        public 
    $economy false;

        public function 
    onLoad() {
            
    $this->getLogger()->info(TextFormat::BLUE "Cargando KillMoney v1.5 por ElGears....");
        }

        public function 
    onEnable() {
            
    $this->config $this->getConfig();
            
    $this->getServer()->getPluginManager()->registerEvents($this$this);
            if(!
    file_exists($this->getDataFolder() . "config.yml")) {
                @
    mkdir($this->getDataFolder());
                 
    file_put_contents($this->getDataFolder() . "config.yml",$this->getResource("config.yml"));
            }
            if(
    $this->config->get("Economy-Plugin") == "Economy") {
                if(
    is_dir($this->getServer()->getPluginPath()."EconomyAPI")) {
            
    $this->getLogger()->info(TextFormat::GREEN."KillMoney   v1.5 por ElGears Actibado por Economic!");
            
    $this->economy true;
                }else{
            
    $this->getLogger()->info(TextFormat::RED."KillMoney No se pudo cargar, no puedo encontrar el plugin");
            
    $this->economy false;
                }
            }
            elseif(
    $this->config->get("Economy-Plugin") == "PocketMoney") {
                if(
    is_dir($this->getServer()->getPluginPath()."PocketMoney")) {
            
    $this->getLogger()->info(TextFormat::GREEN."KillMoney v1.5 por ElGears se activa con PocketMoney!");
            
    $this->economy true;
                }else{
            
    $this->getLogger()->info(TextFormat::RED."KillMoney No se pudo cargar, no puedo encontrar el plugin PocketMoney");
            
    $this->economy false;
                }
            }
        }

        public function 
    onDisable() {
            
    $this->getLogger()->info(TextFormat::GREEN "KillMoney v1.5 por ElGears Desactibado!");
        }
       
        public function 
    onDeath(PlayerDeathEvent $event) {
            
    $cause $event->getEntity()->getLastDamageCause();
            if(
    $cause instanceof EntityDamageByEntityEvent) {
                
    $player $event->getEntity();
                
    $killer $event->getEntity()->getLastDamageCause()->getDamager();
                if(
    $killer instanceof Player) {
                    
    $imessage str_replace("@coins"$this->config->get("Money"), $this->config->get("Message"));
                    
    $message str_replace("@player"$player->getName(), $imessage);
                    if(
    $this->config->get("Economy-Plugin") == "Economy") {
                        
    $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->addMoney($killer->getName(), $this->config->get("Money"));
                        
    $killer->sendMessage($message);
                    }
                    elseif(
    $this->config->get("Economy-Plugin") == "PocketMoney") {
                        
    $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($killer->getName(), $this->config->get("Money"));
                        
    $killer->sendMessage($message);
            elseif(
    $killed instanceof PlayerDeathEvent) {
                
    $killed $event->getEntity()->getPlayerDeath();
                if(
    $killed instanceof Player) {
                    
    $imessage str_replace("@coins"$this->config->get("TakeMoney"), $this->config->get("TakeMessage"));
                    
    $message str_replace("@player"$player->getName(), $imessage);
                    if(
    $this->config->get("Economy-Plugin") == "Economy") {
                        
    $this->getServer()->getPluginManager()->getPlugin("EconomyAPI")->takeMoney($killed->getName(), $this->config->get("TakeMoney"));
                        
    $killed->sendMessage($message);
                    }
                    elseif(
    $this->config->get("Economy-Plugin") == "PocketMoney") {
                        
    $this->getServer()->getPluginManager()->getPlugin("PocketMoney")->grantMoney($killed->getName(), $this->config->get("TakeMoney"));
                        
    $killed->sendMessage($message);
                    }
                }
           }  
       }
                    }
                }
            }
        }

    }
  2. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    hint: Try asking this on the new forum as it is quite inactive here
    HimbeersaftLP and SamGamgee55 like this.
  3. S3nS3IW00
    Offline

    S3nS3IW00 New Member

    Joined:
    Dec 20, 2016
    Posts:
    3
    Minecraft User:
    S3nS3IW00
  4. jasonwynn10
    Offline

    jasonwynn10 Active Member

    Joined:
    Dec 20, 2015
    Posts:
    87
    Minecraft User:
    jasonwynn10
    did you mean to say compile it rather than compilite?
  5. S3nS3IW00
    Offline

    S3nS3IW00 New Member

    Joined:
    Dec 20, 2016
    Posts:
    3
    Minecraft User:
    S3nS3IW00
    I'm amateur in PhP and I need to complite this plugin for my server, but I can't make this complite :(
  6. Thunder33345
    Offline

    Thunder33345 Notable Member

    Joined:
    Apr 3, 2014
    Posts:
    755
    Minecraft User:
    Thunder33345
    HimbeersaftLP and SamGamgee55 like this.

Share This Page

Advertisement