InfinityGamers / Weapons

Experimental guns plugin for PocketMine
Other
13 stars 5 forks source link

announce player death #5

Closed ghost closed 3 years ago

ghost commented 5 years ago

can u make it announce player's death? like not by the plugin by pocketmine itself like edit the plugin so pocketmine know that the player has died by something like CAUSE::PROJECTILE or CAUSE::CUSTOM idk, so that we can use this plugin with other plugins and extend its functionality.

ghost commented 5 years ago

plugins crash when they try to getDamager of player who died by the guns

ghost commented 5 years ago

maybe change the bullet to snowball?

KadTheHunter commented 5 years ago

I agree with this, although if I'm reading the config correctly, changing it to a snowball wouldn't help, as you could set the Projectile to be a Sword for all the plugin cares. I haven't actually tested that ofc, but it should be possible. Therefore, your earlier mention of finding a way to set a custom cause of death, would probably be the best way to solve this.

KadTheHunter commented 5 years ago

@mote166 Have you tried this as a method onDeath? $cause = $event->getPlayer()->getLastDamageCause(); if($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player) { $killer = $cause->getDamager(); $event->setDeathMessage("§f•§r " . $killer . " §fkilled§r " . $name); }

ghost commented 5 years ago

looks like i can no longer test anything since my test server started kicking me each time i join with Blocked 10.89.218.194 for 300 seconds and i have no other way to test plugins except by this android client hosted server .

KadTheHunter commented 5 years ago

$cause = $event->getEntity()->getLastDamageCause(); if ($cause instanceof EntityDamageByEntityEvent){ if ($cause->getDamager() instanceof Player) { $killer = $cause->getDamager(); $this->eco = $this->getServer()->getPluginManager()->getPlugin("EconomyAPI"); $this->eco->addMoney($killer, 10); $killer->sendTip("§eYou earned $10 for killing " . $name . "!"); } } }

I'm about to test this on my server, I'll let you know if it works. (If you need a new server host, check out WitherHost, their great and free)

ghost commented 4 years ago

@KadTheHunter did your code work?

ghost commented 4 years ago

i just tested both the codes you sent and none of them worked.

KadTheHunter commented 3 years ago

Oof this was well over a year ago, but I believe it failed. Given the Dev hasn't responded to a single open issue in this repo, I plan on asking another dev i know to make a guns plugin, and maybe uh incorporate the requests here.

xBeastMode commented 3 years ago

This is an experimental plugin, it is not meant to be used in production servers. Most of my open source work is experiemental and I don't plan on updating it any longer. Apologies, will add this to the readme.