예제 #1
0
        public bool RemoveTattoo(Client player, string collection, string name)
        {
            if (!(player.model == (int)PedHash.FreemodeMale01 || player.model == (int)PedHash.FreemodeFemale01))
            {
                return(false);
            }
            if (!IsCollectionValid(collection) || !IsTattooValid(collection, name) || !PlayerTattoos.ContainsKey(player.handle))
            {
                return(false);
            }

            PlayerTattooData tattoo_obj = PlayerTattoos[player.handle].FirstOrDefault(t => t.Collection == collection && t.Name == name);

            if (tattoo_obj == null)
            {
                return(false);
            }

            PlayerTattoos[player.handle].Remove(tattoo_obj);

            API.sendNativeToAllPlayers(Hash.CLEAR_PED_DECORATIONS, player.handle);

            foreach (PlayerTattooData tattoo in PlayerTattoos[player.handle])
            {
                API.sendNativeToAllPlayers(Hash._SET_PED_DECORATION, player.handle, API.getHashKey(tattoo.Collection), ((player.model == (int)PedHash.FreemodeMale01) ? tattoo.TattooMaleHash : tattoo.TattooFemaleHash));
            }

            player.setSyncedData("TattooData", API.toJson(PlayerTattoos[player.handle]));
            return(true);
        }
예제 #2
0
        public bool AddTattoo(Client player, string collection, string name)
        {
            if (!(player.model == (int)PedHash.FreemodeMale01 || player.model == (int)PedHash.FreemodeFemale01))
            {
                return(false);
            }
            if (!IsCollectionValid(collection) || !IsTattooValid(collection, name) || !PlayerTattoos.ContainsKey(player.handle))
            {
                return(false);
            }
            if (HasTattoo(player, collection, name))
            {
                return(false);
            }

            PlayerTattooData new_tattoo = new PlayerTattooData(collection, name);

            PlayerTattoos[player.handle].Add(new_tattoo);

            API.sendNativeToAllPlayers(Hash._SET_PED_DECORATION, player.handle, API.getHashKey(collection), ((player.model == (int)PedHash.FreemodeMale01) ? new_tattoo.TattooMaleHash : new_tattoo.TattooFemaleHash));
            player.setSyncedData("TattooData", API.toJson(PlayerTattoos[player.handle]));
            return(true);
        }