Example #1
0
        public int CreateBlip(NetHandle ent)
        {
            if (ent.IsNull || !ent.Exists())
            {
                return(0);
            }

            int localEntityHash;
            var obj = new BlipProperties();

            obj.EntityType        = (byte)EntityType.Blip;
            obj.AttachedNetEntity = ent.Value;
            obj.Dimension         = ServerEntities[ent.Value].Dimension;
            obj.Position          = ServerEntities[ent.Value].Position;
            obj.Sprite            = 0;
            obj.Alpha             = 255;
            obj.Scale             = 1f;
            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Blip;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.EntityBackend);

            return(localEntityHash);
        }
Example #2
0
        public int CreateBlip(NetHandle ent)
        {
            if (ent.IsNull || !ent.Exists())
            {
                return(0);
            }

            int localEntityHash = ++EntityCounter;
            var obj             = new BlipProperties();

            obj.EntityType        = (byte)EntityType.Blip;
            obj.AttachedNetEntity = ent.Value;
            obj.Position          = ServerEntities[ent.Value].Position;
            ServerEntities.Add(localEntityHash, obj);

            var packet = new CreateEntity();

            packet.EntityType = (byte)EntityType.Blip;
            packet.Properties = obj;
            packet.NetHandle  = localEntityHash;

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true);

            return(localEntityHash);
        }
Example #3
0
 public NetHandle createBlip(NetHandle entity)
 {
     if (entity.IsNull || !entity.Exists())
     {
         throw new ArgumentNullException(nameof(entity));
     }
     return(new NetHandle(Program.ServerInstance.NetEntityHandler.CreateBlip(entity)));
 }
Example #4
0
        public int CreateBlip(NetHandle ent)
        {
            if (ent.IsNull || !ent.Exists())
            {
                return(0);
            }

            int localEntityHash;
            var obj = new BlipProperties
            {
                EntityType        = (byte)EntityType.Blip,
                AttachedNetEntity = ent.Value,
                Dimension         = ServerEntities[ent.Value].Dimension,
                Position          = ServerEntities[ent.Value].Position,
                Sprite            = 0,
                Alpha             = 255,
                Scale             = 1f
            };

            lock (ServerEntities)
            {
                localEntityHash = GetId();
                ServerEntities.Add(localEntityHash, obj);
            }

            var packet = new CreateEntity
            {
                EntityType = (byte)EntityType.Blip,
                Properties = obj,
                NetHandle  = localEntityHash
            };

            Program.ServerInstance.SendToAll(packet, PacketType.CreateEntity, true, ConnectionChannel.NativeCall);

            return(localEntityHash);
        }