Hey guys
Im trying myselfe on creating my first plugin.
I aim to make a simple killcounter in the bottom left of the screen and i wanna put it in a logfile so the kills stay if someone rejoins.
Im pretty new to the rust API but have lots of experience with java.. im trying myselfe on c#but the logic is close to the same .
What do i need to know for this plugin.Who could teach me and is there a OnPlayerKill?
~oli
PS: sry for my bad english
Need info for creating a couple plugins
Discussion in 'Rust Development' started by ItsOliDude, Oct 16, 2017.
-
You want to use OnEntityDeath since OnPlayerDie is called when the player is wounded. It's fairly simple. I'd do something like this:
Code:private Dictionary<ulong, int> _killStreaks = new Dictionary<ulong, int>();private void OnPlayerInit(BasePlayer playter) => _killStreaks.Add(player.userID, 0);private void OnPlayerDisconnected(BasePlayer player => _killStreaks.Remove(player.userID);private void OnEntityDeath(BaseCombatEntity entity, HitInfo info) { // Get initiator, add to their streak, then redraw the UI. Make sure to reset the victim's streak and redraw their UI as well. }