GetSkinName and GetSkinID

Started by KAKAN, Mar 07, 2016, 06:09 PM

Previous topic - Next topic

KAKAN

First, I'll give credits to @Kusanagi for fixing the GetSkinName bug.
So, here is the snippet, which would support both custom skins and normal skins.
Add this to the top( not really necessary to add at top ) of your script:
SkinName <- [
  "Tommy Vercetti",
  "Cop",
  "SWAT",
  "FBI",
  "Army",
  "Paramedic",
  "Firefighter",
  "Golf Guy #1",
  "Tommy Vercetti",
  "Bum Lady #1",
  "Bum Lady #2",
  "Punk #1",
  "Lawyer",
  "Spanish Lady #1",
  "Spanish Lady #2",
  "Cool Guy #1",
  "Arabic Guy",
  "Beach Lady #1",
  "Beach Lady #2",
  "Beach Guy #1",
  "Beach Guy #2",
  "Office Lady #1",
  "Waitress #1",
  "Food Lady",
  "Prostitute #1",
  "Bum Lady #3",
  "Bum Guy #1",
  "Garbageman #1",
  "Taxi Driver #1",
  "Haitian #1",
  "Criminal #1",
  "Hood Lady",
  "Granny #1",
  "Businessman #1",
  "Church Guy",
  "Club Lady",
  "Church Lady",
  "Pimp",
  "Beach Lady #3",
  "Beach Guy #3",
  "Beach Lady #4",
  "Beach Guy #4",
  "Businessman #2",
  "Prostitute #2",
  "Bum Lady #4",
  "Bum Guy #2",
  "Haitian #2",
  "Construction Worker #1",
  "Punk #2",
  "Prostitute #3",
  "Granny #2",
  "Punk #3",
  "Businessman #3",
  "Spanish Lady #3",
  "Spanish Lady #4",
  "Cool Guy #2",
  "Businessman #4",
  "Beach Lady #5",
  "Beach Guy #5",
  "Beach Lady #6",
  "Beach Guy #6",
  "Construction Worker #2",
  "Golf Guy #2",
  "Golf Lady",
  "Golf Guy #3",
  "Beach Lady #7",
  "Beach Guy #7",
  "Office Lady #2",
  "Businessman #5",
  "Businessman #6",
  "Prostitute #2",
  "Bum Lady #4",
  "Bum Guy #3",
  "Spanish Guy",
  "Taxi Driver #2",
  "Gym Lady",
  "Gym Guy",
  "Skate Lady",
  "Skate Guy",
  "Shopper #1",
  "Shopper #2",
  "Tourist #1",
  "Tourist #2",
  "Cuban #1",
  "Cuban #2",
  "Haitian #3",
  "Haitian #4",
  "Shark #1",
  "Shark #2",
  "Diaz Guy #1",
  "Diaz Guy #2",
  "DBP Security #1",
  "DBP Security #2",
  "Biker #1",
  "Biker #2",
  "Vercetti Guy #1",
  "Vercetti Guy #2",
  "UndercoverCop #1",
  "UndercoverCop #2",
  "UndercoverCop #3",
  "UndercoverCop #4",
  "UndercoverCop #5",
  "UndercoverCop #6",
  "Rich Guy",
  "Cool Guy #3",
  "Prostitute #3",
  "Prostitute #4",
  "Diaz",
  "Love Fist #1",
  "Ken Rosenburg",
  "Candy Suxx",
  "Hilary",
  "Love Fist #2",
  "Phil",
  "Rockstar Guy",
  "Sonny",
  "Lance",
  "Mercedes",
  "Love Fist #3",
  "Alex Shrub",
  "Lance (Cop)",
  "Lance",
  "Cortez",
  "Love Fist #4",
  "Columbian Guy #1",
  "Hilary (Robber)",
  "Mercedes",
  "Cam",
  "Cam (Robber)",
  "Phil (One Arm)",
  "Phil (Robber)",
  "Cool Guy #4",
  "Pizza Man",
  "Taxi Driver #1",
  "Taxi Driver #2",
  "Sailor #1",
  "Sailor #2",
  "Sailor #3",
  "Chef",
  "Criminal #2",
  "French Guy",
  "Garbageman #2",
  "Haitian #5",
  "Waitress #2",
  "Sonny Guy #1",
  "Sonny Guy #2",
  "Sonny Guy #3",
  "Columbian Guy #2",
  "Haitian #6",
  "Beach Guy #8",
  "Garbageman #3",
  "Garbageman #4",
  "Garbageman #5",
  "Tranny",
  "Thug #5",
  "SpandEx Guy #1",
  "SpandEx Guy #2",
  "Stripper #1",
  "Stripper #2",
  "Stripper #3",
  "StoreClerk",
  "Tommy Vercetti",
  "Tommy with Suit",
  "Worker Tommy",
  "Golfer Tommy",
  "Cuban Tommy",
  "VCPD Tommy",
  "Bank Robber Tommy",
  "Street Tommy",
  "Mafia Tommy",
  "Jogger Tommy #1",
  "Jogger Tommy #2",
  "Guy With Suit #1",
  "Guy With Suit #3",
  "Prostitute #5",
  "Rico",
  "Prostitute #3",
  "Club Lady",
  "Prostitute #2",
  "Skull T-Shirt Guy",
  "Easter Egg Tommy",
  "Diaz Gangster #1",
  "Diaz Gangster #2",
  "Hood Lady",
  "Punk #1",
  "Tray Lady",
  "Kent Paul",
  "Taxi Driver #1",
  "Deformed Ken Rosenberg",
  "Deformed Woman",
  "Deformed Man",
  "DeformedCortez",
  "Deformed Lance Vance",
  "Thief #1",
  "Thief #2",
  "Thief #3",
  "Thief #4",
  "Theif #5",
  "Theif #6",
  "Theif #7",
  "Custom Skin 1",
  "Custom Skin 2",
  "Custom Skin 3",
  "Custom Skin 4",
  "Custom Skin 5",
  "Custom Skin 6",
  "Custom Skin 7",
  "Custom Skin 8",
  "Custom Skin 9",
  "Custom Skin 10",
  "Custom Skin 11",
  "Custom Skin 12",
  "Custom Skin 13",
  "Custom Skin 14",
  "Custom Skin 15",
  "Custom Skin 16",
  "Custom Skin 17",
  "Custom Skin 18",
  "Custom Skin 19",
  "Custom Skin 20",
  "Custom Skin 21",
  "Custom Skin 22",
  "Custom Skin 23",
  "Custom Skin 24",
  "Custom Skin 25",
  "Custom Skin 26",
  "Custom Skin 27",
  "Custom Skin 28",
  "Custom Skin 29",
  "Custom Skin 30",
  "Custom Skin 31",
  "Custom Skin 32",
  "Custom Skin 33",
  "Custom Skin 34",
  "Custom Skin 35",
  "Custom Skin 36",
  "Custom Skin 37",
  "Custom Skin 38",
  "Custom Skin 39",
  "Custom Skin 40",
  "Custom Skin 41",
  "Custom Skin 42",
  "Custom Skin 43",
  "Custom Skin 44",
  "Custom Skin 45",
  "Custom Skin 46",
  "Custom Skin 47",
  "Custom Skin 48",
  "Custom Skin 49",
  "Custom Skin 50"
  ];
That contains all the skin names and IDs.
And this is the GetSkinName function:
function GetSkinName( ID )
{
  try
  {
    return SkinName[ ID ];
  }
  catch( e )
  {
    return null;
  }
}
And this is the GetSkinID part:
function GetSkinID( NAME )
{
  foreach( idx, skin in SkinName )
  {
    if( skin.tolower().find( NAME.tolower() ) != null ) return idx;
  }
}
You can actually minify the script, but I did it this way, so that newbies can understand and edit it easily.
Hope you liked it.
oh no

=RK=MarineForce

#1
 " + GetSkinName( player.Skin ) + "

how to get vehicle name ?

" + GetVehicleName( player.Vehicle ) + "

Mötley

Quote from: =RK=MarineForce on Jan 17, 2018, 10:23 AM" + GetSkinName( player.Skin ) + "

how to get vehicle name ?

" + GetVehicleName( player.Vehicle ) + "

        local vehicle = CreateVehicle( text, player.Pos, player.Angle, rand() % 99, rand() % 99);
        player.Vehicle = vehicle;
        MessagePlayer("Vehicle Spawned: " + GetVehicleNameFromModel( text ), player );

It's vehicle.Model