Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ This ModuleScript is part of GroupClothesManager (which isn't released yet)]]--
- local Tag = require(script.Parent)
- --[=[ [[ STANDARD/RAW TAG CREATION ]]
- This is the default kind of tag.
- Every other tag points to or wraps this kind of tag.
- Creating a tag is very simple using the code below.
- (It may look difficult, but if you read it once or twice...)
- You can put this tag in your group description.
- That way, when someone joins a game (with GCM) that's in your group,
- the tag will be read from the description and clothes will be registered.
- Syntax for creating a tag:
- Tag.FactoryForGroup(GroupId)
- --> Returns a new Factory
- Factory:AddAsset(rank,asset)
- --> Adds the given asset(id) to the tag for the given rank (0-255)
- --> The assetid may only be a Shirt/Pants, or it won't do anything
- Factory:Finish()
- --> Returns a tag with the already given data in it
- --> You can do "AddAsset(A) Finish() AddAsset(B) Finish()"
- Then the first Finish() will contain only A.
- The second finish() will contain A and B.
- If you want to restart, create a new factory.
- --]=]
- -- 1158880 is "einsteinK's Studios"
- local res = Tag.FactoryForGroup(1158880)
- -- 1 is a rank (0-255) in that group, in this case being "Fan/Customer"
- -- 152266143 is a Shirt called "Galaxy" (took a random one)
- res:AddAsset(1,152266143)
- -- 152266143 is a Pants called "Galaxy" (previous had link, why not use it...)
- res:AddAsset(1,152266080)
- -- 254 is the "Admin/Developer" rank in my group
- -- 305818459 is "Cyan & Black adidas Shirt", yet another Shirt
- res:AddAsset(254,305818459)
- -- Get the resulting tag and print it
- print("\nStandard tag:",res:Finish())
- --> =gcmrGpv74A2jom9dA2jomc3R72A522s17=
- -- Quick validation
- -- Should print your group ID and every asset with its required rank
- local data = Tag.Parse(res:Finish())
- for k,v in pairs(data) do
- print("Group ID:",k)
- for a,b in pairs(v.Assets) do
- print("\tAsset",a,"for rank",b)
- end
- end
- -- Once you edited (and copied some of the lines again) the code, just
- -- run this script and put the resulting string in your group description.
- -- (or read further and do the more advanced stuff... your choice)
- --[=[ [[ PASTEBIN TAG CREATION ]]
- A pastebin tag is a tag that says "load all tags from this pastebin file".
- Simple to create, simple to use.
- Best used with a paste you can edit, allowing you to update GCM tags
- without having to recreate tags and put them in your group's desc again etc.
- It's also handy if you have 20 tags and don't want to clutter your group description.
- Just put all the tags in a pastebin file and in your description use a pastebin tag.
- --]=]
- -- You just give it the paste ID
- -- This one is from the official pastebin file
- local res = Tag.NewReadFromPastebin("eDRqBqiF")
- print("\nPastebin tag:",res)
- --> =gcmpeDRqBqiF=
- --[=[ [[ ASSET TAG CREATION ]]
- An asset tag is a tag that says "load all tags from this asset's description".
- Simple to create, simple to use, very similar to the pastebin tag.
- The description of a model/decal/shirt/.. (any asset) will work.
- There's a limit on how long such a description can be, so it isn't that good.
- It works fine if you don't have a lot of clothes, so it fits in one description.
- You can always have several assets and put their tag in one asset to link them.
- (Your group uses asset A, asset A uses asset B1,B2,B3,...)
- --]=]
- -- This would read all tags from SWOTH
- -- (There aren't any tags in the description, so a bit useless)
- local res = Tag.NewReadFromAsset(1818)
- print("\nAsset tag:",res)
- --> =gcma1fj=
- --[=[ [[ INHERITANCE TAG CREATION ]]
- An inheritance tag is nice for group with sub groups.
- (Stuff like armies with extra groups for certain divisions)
- Imagine your group has group ID 12345.
- You have another group for the high ranks with ID 345345.
- You would like for 345345 to have the same clothes as 12345.
- You can create an inheritance tag for the group 12345.
- If you put it in 345345's description, it'll inherit from 12345.
- That means, when 345345 loads its clothes, it loads them 12345.
- It's a bit more advanced than this:
- - You'll get all 12345's clothes, read from their description
- - You'll get all the clothes in that same description for your group
- This means 12345 can say "345345 should also have those clothes".
- 12345 won't get those clothes, but 345345 would
- - You won't get clothes that aren't meant for 12345 or 35345
- (e.g. 12345 has "those clothes for other subgroup 987", won't count)
- --]=]
- -- You just give it the group ID
- -- This one is ROBLOX' admin group
- local res = Tag.NewInheritFromGroup(7)
- print("\nInheritance tag:",res)
- --> =gcmi7=
- -- If they had clothes registered for GCM in their description, if you
- -- put this tag in your group's description, you would also get their clothes
- --[=[ [[ COPY TAG CREATION ]]
- A copy tag is a nice way of converting clothes between groups, sort of.
- You could create a copy tag for groups A and B for tag TAG.
- That would make ALL clothes that appear in TAG, no matter for which
- group they're meant (including group C,D,...) available to A and B.
- It's literally copying the clothes from a tag to your own group(s).
- (It's like a group inheritance tag, but without limitations)
- --]=]
- -- This contains the asset 1 for rank 1 for group 1158880
- -- This also contains asset 2 for rank 2 for group 7
- -- Group with ID 1158880, ID 7 and ID 8
- local test = "=gcmrGpv74A1G7R2A2="
- -- Creating a copy for 123 and 456
- local res = Tag.NewCopyFromTag({123,456},test)
- print("\nCopy tag:",res)
- --> =gcmt3g,dp=gcmrGpv74A1G7R2A2==
- -- Again: Validate to make sure it worked
- -- This should print 2 groups: 123 and 456.
- -- They'll both have asset 1 for rank 1 and asset 2 for rank 2
- -- (All clothes from the test tag are copied for them)
- local data = Tag.Parse(res)
- for k,v in pairs(data) do
- print("Group ID:",k)
- for a,b in pairs(v.Assets) do
- print("\tAsset",a,"for rank",b)
- end
- end
- --[=[ [[ SECURE TAG CREATION ]]
- A secure tag is basicly a way to say:
- "I want to parse this tag, but only those groups may be in it"
- It's very handy if you add a not-so-trusted tag as trusted tag.
- (This isn't really a good idea, it's less secure, but surely easier)
- When you add groups X,X+1,X+2,N to the tag, it's only valid for those groups.
- If the actual tag embedded in it has data for groups ranging from X to N+2,
- it would only return the data for X to N, ignoring data for N+1 and N+2.
- This tag is meant to be used in combination with a "remote tag".
- Something like an asset/pastebin tag, that don't have security by default.
- You could create a tag for group 123 that contains the tag for a paste of that group.
- They can edit the paste to add, edit or remove tags.
- They might, however, also add tags for group 456, even if they have nothing to do with them.
- If you use a secure tag and (only) add 123 to the list, they can't do stuff for group 456.
- You can add multiple groups to the secure list: The main group, a sub division, ...
- --]=]
- -- This contains the asset 1 for rank 1 for those 3 groups:
- -- Group with ID 1158880, ID 7 and ID 8
- local test = "=gcmrGpv74A1G7A1G8A1="
- -- Creating a secure tag for 1158880 and 7 (Notice: not 8)
- local res = Tag.NewSecureTag({1158880,7},test)
- print("\nSecure tag:",res)
- --> =gcmspv74,7=gcmrGpv74A1G7A1G8A1==
- -- Again: Validate to make sure it worked
- -- This should only print assets for 1158880 and 7 since
- -- group 8 isn't in the secure list, so doesn't get added
- local data = Tag.Parse(res)
- for k,v in pairs(data) do
- print("Group ID:",k)
- for a,b in pairs(v.Assets) do
- print("\tAsset",a,"for rank",b)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement