Пример #1
0
        public IBlip CreateBlip(IPlayer player, byte type, Position pos)
        {
            var ptr = AltNative.Server.Server_CreateBlip(NativePointer, player?.NativePointer ?? IntPtr.Zero,
                                                         type, pos);

            return(blipPool.Get(ptr, out var blip) ? blip : null);
        }
Пример #2
0
        public IColShape CreateColShapeCylinder(Position pos, float radius, float height)
        {
            CheckIfCallIsValid();
            var ptr = AltNative.Server.Server_CreateColShapeCylinder(NativePointer, pos, radius, height);

            return(colShapePool.Get(ptr, out var colShape) ? colShape : null);
        }
Пример #3
0
        public IVoiceChannel CreateVoiceChannel(bool spatial, float maxDistance)
        {
            var ptr = AltNative.Server.Server_CreateVoiceChannel(NativePointer,
                                                                 spatial, maxDistance);

            return(voiceChannelPool.Get(ptr, out var voiceChannel) ? voiceChannel : null);
        }
Пример #4
0
        public ICheckpoint CreateCheckpoint(byte type, Position pos, float radius, float height,
                                            Rgba color)
        {
            var ptr = AltNative.Server.Server_CreateCheckpoint(NativePointer, type, pos, radius, height, color);

            return(checkpointPool.Get(ptr, out var checkpoint) ? checkpoint : null);
        }
Пример #5
0
 public IBaseObject Get(IntPtr entityPointer, BaseObjectType baseObjectType)
 {
     return(baseObjectType switch
     {
         BaseObjectType.Player => playerPool.Get(entityPointer),
         BaseObjectType.Vehicle => vehiclePool.Get(entityPointer),
         BaseObjectType.Blip => blipPool.Get(entityPointer),
         BaseObjectType.Checkpoint => checkpointPool.Get(entityPointer),
         BaseObjectType.VoiceChannel => voiceChannelPool.Get(entityPointer),
         BaseObjectType.ColShape => colShapePool.Get(entityPointer),
         _ => default
     });
 public IBaseObject?Get(IntPtr entityPointer, BaseObjectType baseObjectType)
 {
     return(baseObjectType switch
     {
         BaseObjectType.LocalPlayer => playerPool.Get(entityPointer),
         BaseObjectType.Player => playerPool.Get(entityPointer),
         BaseObjectType.Vehicle => vehiclePool.Get(entityPointer),
         BaseObjectType.Blip => blipPool.Get(entityPointer),
         BaseObjectType.Checkpoint => checkpointPool.Get(entityPointer),
         BaseObjectType.Audio => audioPool.Get(entityPointer),
         BaseObjectType.HttpClient => httpClientPool.Get(entityPointer),
         BaseObjectType.WebsocketClient => webSocketClientPool.Get(entityPointer),
         BaseObjectType.Webview => webViewPool.Get(entityPointer),
         BaseObjectType.RmlElement => rmlElementPool.Get(entityPointer),
         BaseObjectType.RmlDocument => rmlDocumentPool.Get(entityPointer),
         _ => default
     });
Пример #7
0
        public bool Get(IntPtr entityPointer, BaseObjectType baseObjectType, out IBaseObject entity)
        {
            bool result;

            switch (baseObjectType)
            {
            case BaseObjectType.Player:
                result = playerPool.Get(entityPointer, out var player);
                entity = player;
                return(result);

            case BaseObjectType.Vehicle:
                result = vehiclePool.Get(entityPointer, out var vehicle);
                entity = vehicle;
                return(result);

            case BaseObjectType.Blip:
                result = blipPool.Get(entityPointer, out var blip);
                entity = blip;
                return(result);

            case BaseObjectType.Checkpoint:
                result = checkpointPool.Get(entityPointer, out var checkpoint);
                entity = checkpoint;
                return(result);

            case BaseObjectType.VoiceChannel:
                result = voiceChannelPool.Get(entityPointer, out var voiceChannel);
                entity = voiceChannel;
                return(result);

            case BaseObjectType.ColShape:
                result = colShapePool.Get(entityPointer, out var colShape);
                entity = colShape;
                return(result);

            default:
                entity = default;
                return(false);
            }
        }