1. Hi All!
    I need to hook mine was spawned on the map.
    i used this hook:
    Code:
            void OnEntitySpawned(BaseNetworkable networkable)
            {
               
            }
    how to I can find player BasePlayer from networkable ?
     
  2. Wulf

    Wulf Community Admin

    Cast BaseNetworkable to BasePlayer, I believe that's all you need.
     
  3. var player = networkable as BasePlayer is the correct use ?
     
  4. Wulf

    Wulf Community Admin

    I'm not certain, I've never tried to convert it before. I think there is more to it than that, but I'd need to dig around.
     
  5. Code:
    if (networkable.isClient) { var player = networkable as BasePlayer }
    work fine for me )) thanks!
    [DOUBLEPOST=1457524218,1457515747][/DOUBLEPOST]
    Code:
        public virtual void Spawn(bool networked = true)
        {
            if (this.isServer)
            {
                if (this.net == null)
                {
                    this.net = Net.sv.CreateNetworkable();
                }
                this.net.owner = this;
                this.creationFrame = Time.frameCount;
                this.PreInitShared();
                this.InitShared();
                this.ServerInit();
                this.PostInitShared();
                this.UpdateNetworkGroup();
                this.isSpawned = true;
                object[] objArray = new object[] { this };
                Interface.CallHook("OnEntitySpawned", objArray);
                this.SendNetworkUpdateImmediate(true);
            }
        }
    this.isServer hook for server entity spawns only =(

    how to hook player entity spawns ?
    [DOUBLEPOST=1457528131][/DOUBLEPOST]I finded some code from source:

    Code:
    BaseEntity.RPCMessage rPCMessage = new BaseEntity.RPCMessage();        rPCMessage.connection
            rPCMessage.player
    if I Cast BaseNetworkable to BaseEntity I can find RPC sender info ???

    OXIDE need SV_RPCMessage hook...
     
    Last edited by a moderator: Mar 9, 2016
  6. Wulf

    Wulf Community Admin

    Players are entities, but you could also use OnPlayerInit or even OnPlayerRespawned.