1. RaptikCZ

    RaptikCZ Naked Wanderer

    Is there propper way to get entityType?

    Code (Text):
          void OnEntityTakeDamage(EntityAlive entity, DamageSource source)
          {
            string _typ = "undef";

            ClientInfo _damaged = ConsoleHelper.ParseParamIdOrName(entity.EntityName);
            string attackerId = source.getEntityId().ToString();

            ClientInfo _attacker = ConsoleHelper.ParseParamIdOrName(attackerId);
            EntityAlive _att = source.getEntityId();
    //        EntityType _entityType = _att.entityType;
    //        if (_entityType == EntityType.Player)
    //        {
    //        if (_entityType == EntityType.Zombie) _typ = "Zed";
    //        if (_entityType == EntityType.Player) _typ = "Player";

    //        Puts($"{_attacker.playerName}({attackerId}) hit {_damaged.playerName}(_damaged.EntityType)");
            Puts($"({attackerId} - {_typ}) hit {_damaged.playerName}({entity.entityType})");
    //       }
          }
    this without: EntityAlive _att = source.getEntityId();


    Code (Text):
    20:15 [Info] Loaded plugin Zones v0.1.0 by raptik
    20:16 [Info] [Zones] (220675 - undef) hit RaptikCZ(Player)
    20:16 [Info] [Zones] (220675 - undef) hit RaptikCZ(Player)
     
    and with: EntityAlive _att = source.getEntityId();

    Code (Text):

    20:17 [Error] Zones plugin failed to compile!
    20:18 [Error] Zones.cs(46,35): error CS0029: Cannot implicitly convert type `int' to `EntityAlive'
    now I am looking for correct way to assign EntityAlive to entityId from source...
     
  2. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    The error is saying you are trying to make an int into something it can't be, so either set it to int or use var.
     
  3. RaptikCZ

    RaptikCZ Naked Wanderer

    hmm and what about: ConsoleHelper.ParseParamEntityIdToEntity ???

    pitty i can try it at tomorrow
     
  4. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    I'm not sure what that is, but you can use whatever you want, you just can't cast or set something to something it can't be.
     
  5. OpenFunRus

    OpenFunRus Plugin Developer

    Code (Text):
            void OnEntityTakeDamage(EntityAlive entity, DamageSource source)
            {
                string _typ = "undef";
                Entity entityKiller = ConsoleHelper.ParseParamEntityIdToEntity(source.getEntityId().ToString());
                if (entity is EntityPlayer)
                {
                    _typ = "Zed";
                }
                PrintWarning(_typ);
            }
    PS:
    1. Detect player on HOOK OnEntityTakeDamage not work on oxide
    2. Convert Entity to EntityAlive code:
    Code (Text):
    EntityAlive entityalive = ConsoleHelper.ParseParamEntityIdToEntity(source.getEntityId().ToString()) as EntityAlive;
     
    Last edited: May 25, 2016
  6. RaptikCZ

    RaptikCZ Naked Wanderer

    thank you.
    i have similar code in my mind.
    i found that it doesnt work on this hook. now i am testing some behavior - it is faster then killing me ;) with hook OnEntityDeath.
     
  7. OpenFunRus

    OpenFunRus Plugin Developer

    OnEntityDeath not work too for player
    --- Double Post Merged, May 25, 2016 ---
    Oxide not have ovveride function, it is bed...
    I'm leaving with the oxide , I will write a standard mods on dll...
     
  8. RaptikCZ

    RaptikCZ Naked Wanderer

    so there is no way how to detect and react on player damage or kill from other player??? i am tried oxide for possible easiestway to implement something like jail or server zones in cbsm dirrectly on server...
     
  9. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    PS. Oxide is open source, so nothing stopping you from contributing if it's so "bed". ;) You can always add your own hooks too if something isn't available, so complain or contribute, your choice.

    Also, 7 Days to Die has native modding support, has since we started adding support. If you don't want to contribute, you can always use that. As I mentioned before, this is the main reason why we haven't advanced support.
    --- Double Post Merged, May 25, 2016, Original Post Date: May 25, 2016 ---
    I'm sure there are ways for everything, it just takes time and people willing to contribute ways to do things as well as improvements.
     
  10. OpenFunRus

    OpenFunRus Plugin Developer

    As I type the programming experience , I will help you. But at the moment a lot to implement. Oxide makes frames for modders . Wolf, If you want help, create post "how you may help me and what you need to do"
     
  11. Wulf

    Wulf Community Admin Community Admin Oxide Developer

    If you want to contribute, just jump in and show us what you've got, I shouldn't have to ask for it.