Does anyone know if this was changed/broken in the most recent update?
I'm using this code: if not entity:ToPlayer() then return end
(it's on OnEntityTakeDamage) and it is now always returning, even though I'm certain the damage being taken is from a player, this was working fine just a few days ago, but is now seemingly broken. Any ideas?
Entity:ToPlayer() not working (LUA)
Discussion in 'Rust Development' started by Shady757, Oct 31, 2015.
-
Wulf Community Admin
It works fine, many plugins use it, I use it in quite a few even. Make sure you are checking for null as well.
-
Yes, I'm aware many plugins use it. m-Teleportation uses it, and it appears to broken in this plugin as well. And as I said before, I've changed literally nothing since the last update, in which it was working fine. Are you sure nothing has changed?
-
Wulf Community Admin
You can check in Rust's DLL, but the ToPlayer() method is still there. I've used it numerous times today as well, no issues from what I can tell. -
Hmm, ok. I'll try restarting my server, don't know what would've caused this. Thanks for replying, will post back if a restart fixed it.
-
Wulf Community Admin
Thinking about it though, I haven't tried it in Lua in awhile, but that shouldn't make any difference. -
Thanks for your help, a server restart *did* fix it, it was also not working with Godmode. Not sure why this happened, I wish I could figure out how/why this happened, though.
-
Wulf Community Admin
Likely a plugin set the entity globally to something invalid. You should always use local variables.
