How might i go about automatically switching a players inventory to another player on death?..something like this? ik its pretty off i just wanted to give you a idea what i was going for here. PHP: public function onPlayerDeath(PlayerDeathEvent $event){$victim = $event->getEntity();$loot = $victim->getInventory(); if($loot != NULL){ $killer->getInventory()->addItem($loot);$event->setDrops([]); }}
What player? the one who died?..ik there's a lot wrong with this I was just trying to show what I was looking for all I really need to know is how to do PHP: $loot = $victim->getInventory(); if($loot != NULL){ $killer->getInventory()->addItem($loot); but the right way and a way that actually works lol
I think you gots it backwards lol the player who dies loses everything in their inventory like usual.. but the stuff don't drop it just transfers into their killers inventory. But I guess I'd have problems if the player didn't have enough slots also..
Yes i was thinking of doing EntityDammageByEntityEvent or how ever that one goes bc thats another problem..once the players dead his inventory will = NULL lol idk..might go a different rout with this. wish i knew how to handle timings..like setting a timer.
Actually a timer would be perfect I think..I'm still not good enough to make awesome plugins by myself. So I am "tampering" with others work /: lol you devs probably frown upon that but its good practice and study. What I am attempting is modifying 1vs1..took away all kits and anything to do with kits and am trying to make it so the player may still get his victims loot before being teleported back to spawn. So a 10 sec timer before tp back to spawn would work perfect.
Trying to start a flames war? There's a difference between copying and modifying. @dxm_hippie said he was learning from it, and was playing around by modifying things in it. And guess what copying means? Copying means completely copying someone's plugin and claiming it's your own(without giving the original author credit). So if you excuse me, don't flame.
You didnt get that i meant By "Copying" and i never stated which kind of copying he was doing so... Please ask before trying to start a War and didnt you see the ""? It's alright to copy people plugins and make it better as long you give them credits / full credits
Stop the flames please. There was nothing wrong initially, and @Gamecrafter started firing at people by being probably oversensitive or simply got bored and wanted to argue with somebody. Please, this is the PocketMine forums. We are not discussing about the disambiguation of English words here. Can you just leave alone that "copying" word, since it has nothing to do with our topic at all? You know, if moderators are a bit more strict, doing this is enough to cost a warning. What about doing that in EntityDamageEvent where health < 0?
Maybe take a look at how LIAB handles it? When a player dies, get the drops and save it. Then setDrops to null. Put all stuff you saved and add it into the killers inv.