Cuberite Forum

Full Version: OnTakeDamage who is the cause?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.