Hello,
I'm trying to make a plugin based on C# which limits fall height. It is based on R-Anticheat (which is awesome btw). Right now i'm able to detect if player is falling. So far so good...
I do not understand how i can decrease a players health. I believe this can be done with hook "OnRunPlayerMetabolism". Is that correct? How do i use this hook in a c# plugin? Another option would be to let the player commit suicide remotely triggered from the plugin. Is that possible?
Best regards
Grinsekotze
C#: decrease player health or commit suicide
Discussion in 'Rust Development' started by Grinsekotze, Feb 16, 2015.
-
this is where the falling is taken care of:
Code:private void OnPlayerLanded(float velocity) { float num = Mathf.InverseLerp(-15f, -100f, velocity); if (num != 0f) { this.metabolism.bleeding.Add(num * 0.5f); this.Hurt(num * 500f, DamageType.Fall, null); } }
so yeah from the metabolism you will have to remove the bleeding
and OnEntityAttacked you will have to check if damatype is FALL, and remove the damage.
something like: hitinfo.damageTypes = new damageTypes blabla, there are plugins showing how to do that (Zone Manager, for exemple you'll just have to convert it into C#)
didn't really try anything but i guess this should get you going.
[DOUBLEPOST=1424095424][/DOUBLEPOST]if you need anyhelp or are stuck somewhere just post the code hereand we will help you fix it
-
@Reneb:
I've made good progress and the plugin is working so far. There are still a few rough edges i'm working on. Would you consider merging my changes to your AntiCheat-Plugin? Imho this makes sense, cause my modded version is also constantly checkin player postion. This would consume additional resources if both plugins are run on the same server. I had to remove the time limited checks cause fall detection needs the player-position-data all the time. What do you think?
I'll post the plugin code here, but i have to clean it up and comment first. -
I would gladly work with you yes, no problem