Ejemplo n.º 1
0
        public Skin(int ped)
        {
            _drawables    = new int[ComponentCount];
            _textures     = new int[ComponentCount];
            _palettes     = new int[ComponentCount];
            _props        = new int[ComponentCount];
            _propTextures = new int[ComponentCount];

            for (int i = 0; i < ComponentCount; ++i)
            {
                _drawables[i]    = API.GetPedDrawableVariation(ped, i);
                _textures[i]     = API.GetPedTextureVariation(ped, i);
                _palettes[i]     = API.GetPedPaletteVariation(ped, i);
                _props[i]        = API.GetPedPropIndex(ped, i);
                _propTextures[i] = API.GetPedPropTextureIndex(ped, i);
            }

            Model   = (uint)API.GetEntityModel(ped);
            Name    = ModelToName(Model);
            IsHuman = API.IsPedHuman(ped);

            if (IsMultiplayerPed(ped))
            {
                MultiplayerSkin = new MultiplayerSkin(ped);
            }
        }
Ejemplo n.º 2
0
        public override bool Equals(object value)
        {
            var other = value as Skin;

            return(other != null && Model == other.Model &&
                   Enumerable.SequenceEqual(_drawables, other._drawables) &&
                   Enumerable.SequenceEqual(_textures, other._textures) &&
                   Enumerable.SequenceEqual(_palettes, other._palettes) &&
                   Enumerable.SequenceEqual(_props, other._props) &&
                   Enumerable.SequenceEqual(_propTextures, other._propTextures) &&
                   (MultiplayerSkin == null || MultiplayerSkin.Equals(other.MultiplayerSkin)));
        }
Ejemplo n.º 3
0
        public virtual void Restore(int ped)
        {
            for (int i = 0; i < ComponentCount; ++i)
            {
                API.SetPedComponentVariation(ped, i, _drawables[i], _textures[i], _palettes[i]);

                if (_props[i] > -1)
                {
                    API.SetPedPropIndex(ped, i, _props[i], _propTextures[i], true);
                }
            }

            MultiplayerSkin?.Restore(ped);
        }
Ejemplo n.º 4
0
        private static void NetSetMPSkin(int netPed, dynamic data)
        {
            var skin = MultiplayerSkin.Deserialize(data);

            skin.Restore(API.NetToPed(netPed));
        }
Ejemplo n.º 5
0
        private static void NetRequestMPSkin(int netPed, int requestingPlayer)
        {
            var skin = new MultiplayerSkin(API.NetToPed(netPed));

            TriggerServerEvent("PocceMod:SetMPSkin", netPed, skin.Serialize(), requestingPlayer);
        }