You could take advantage of the GetSkinID()
function from the latest plug-in update:
if ( cmd == "skin" )
if ( !player.IsSpawned ) MessagePlayer( "You have to be spawned to use this command.", player );
else if ( !text ) MessagePlayer( "Syntax, /" + cmd + " <TAG>", player );
local skin_id = GetSkinID(text);
if (skin_id < 0) MessagePlayer( "Could not identify the specified skin tag.", player );
player.Skin = skin_id;
MessagePlayer( "Skin changed to: " + GetSkinName( player.Skin ), player );
By short-tag I mean you don't have to use the full skin name. All you need is a few key letters to help identify the skin. Like "tv" for [To]mmy [V]ercetti. For example you could do: /skin ha3
([Ha]tian 3/C). You can also use the full name if you want to. Even other symbols or different case. The search strips symbols and is case insensitive.
It's a small function to retrieve the skin id from the name. The function should (theoretically) work for both full names or simple short tags.
Example of short tags where every item in the list point to the same id:
They all point to Candy Suxx
They all point to Garbage man 1
- Garbage man 1
- Garbage man a
As long as the short tag doesn't interfere with another name then it tries to be as simple as possible.
The search doesn't care about trailing spaces, case sensitivity or non-alphanumeric symbols:
They all point to Love Fist 4/D
- ------Lo*%ve F&ist^374
- Love 4
You can also use a, b, c, d ... instead of 1, 2, 3, 4 because some IDs share the same skin name and precise numeric identification wouldn't be accurate.