Hi I am using the void OnEntityDeath(BaseCombatEntity vic, HitInfo hitInfo) to select a player (based on if he is killer or victim).
I would like to use the sendthereply and send a message1 to the attacker and a message2 to the victim. I use the id of the killer and I get no error. When I try in-game I see no message showing.
Here is the code to send the attacker (uidk is the killer id reference)
SendTheReply(uidk, "-25 to your profile");
And here is the SendTheReply code used in many plugins which works with BasePlayer.
I noticed that the attacker/victim that are from OnEntityDeath, are used in a BaseCombatEntity (not in GamePlayer).
So I tried to change the sendreply toCode:private void SendTheReply(object source, string msg) { if (source is BasePlayer) SendReply((BasePlayer)source, msg); else if (source is ConsoleSystem.Arg) SendReply((ConsoleSystem.Arg)source, msg); else Puts(msg); }
else if (source is BaseCombatEntity)
SendReply((BaseCombatEntity)source, msg);
But of course I get an error.
Can you help me get the victim/killer msg inside that OnEntityDeath void? thanks
SendReply with BaseCombatEntity?
Discussion in 'Rust Development' started by FireBurst, Aug 29, 2015.
-
Should work.Code:
BasePlayer attacker = (BasePlayer)hitInfo.Initiator; BasePlayer player = (BasePlayer)entity.ToPlayer();SendReply(player, "Sth"); SendReply(attacker, "Sth");
