OnTakeDamage who is the cause? - Printable Version +- Cuberite Forum (https://forum.cuberite.org) +-- Forum: Plugins (https://forum.cuberite.org/forum-1.html) +--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html) +--- Thread: OnTakeDamage who is the cause? (/thread-590.html) |
OnTakeDamage who is the cause? - ThuGie - 10-20-2012 Hey, I want to stop people who arent logged in, Not be able to cause damage. But there is no Player:GetName() its something i need. I guess Pawn is cPlayer when the player is hit its also what i need. But i have no way to check what is causing the damage. Or even a way to damage the person who is causing the damage. What some future plugins might need for who knows. RE: OnTakeDamage who is the cause? - Taugeshtu - 10-22-2012 Wrong! Wrong, wrong, wrong and wrong. And wrong once again. (sorry, I'm just enjoying it) There is cPlayer:GetName(), more than that - it works (look at playerlist in webadmin). cPawn could be cPlayer and could NOT be a cPlayer as well. Use cEntity:GetEntityType() to check if you're dealing with player. There is some trick I can't remember now to get a cPlayer instance from your cPawn instance. And sorry, but you have a way to check what's causing damage. It's inside TakeDamageInfo. But I'm wondering if you actually want your not-logged-in players to be prevented from just making damage to other players and what for you want it that way. Could be much easier to cancel left-click with OnBlockDig hook. |