1. Tried a simple:
    rust.SendChatMessage(attacker, "Test) and got no response...
     
  2. Wulf

    Wulf Community Admin

  3. Code:
    function PLUGIN:OnEntityAttacked( ent, hitinfo )
      if(hitinfo == nil) then return end
      if(hitinfo.Initiator == nil) then return end
      if(hitinfo.Initiator.GetComponent(global.BasePlayer._type)) then
        var attacker = hitinfo.Initiator.GetComponent(global.BasePlayer._type)
        rust.SendChatMessage(attacker, "Test)
      end
    end
     
  4. Yay, I was already using OnEntityAttacked for a separate type of funcs, but gonna use it for everything now, tnx guys ;)
     
  5. Wulf

    Wulf Community Admin

    The latest builds have OnPlayerAttacked added back, just letting you know. :)
     
  6. Hmmm that could be useful.
    OnPlayerAttacked would be better than Entity cuz that way I can manage my friendly fire mode separately from the Shield and Armor skills that I've created.
     
  7. Just create two different functions, and have OnEntityAttacked call them both? seems cleaner than using OnPlayerAttacked
     
  8. That depends Colonel. I've skills on my RPG plugin (WIP) where players increase their damage, so if I could calc with "OnPlayerAttack" that would be better. But since Attacked is almost the same for Player and Entity, dont mind in keep only entity
     
  9. c#:
    void OnEntityAttacked(MonoBehaviour entity, HitInfo info)
    {
    if (entity != null && info != null && info.HitEntity && (string)info.HitEntity.ToString() == "player/player (BasePlayer)")//i assume you need it for players
    {
    // do what ever
    }
    }