Scripting/Squirrel/Functions/Players/Skin

From VC-MP Wiki

Jump to: navigation, search

NOTE: This function has been modified in VC:MP 0.3z r2. It may work as in previous versions, and offer additional functionality.


This instance variable returns or sets the skin player is using. Note: Since R2 it's been possible to set the player skin as well.

Syntax

int Player.Skin

Player.Skin = int iNewSkin

Example 1. Returning

This command gives player the skin ID they are using when they type '/c skin'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "skin" )
     {
          MessagePlayer( "Your current skin: " + GetSkinName( player.Skin ), player );
     }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Example 2. Setting

This command sets the player skin when they type '/c setskin SkinID'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "setskin" )
     {
          if ( IsNum( text ) )
          {
               player.Skin = text.tointeger();
               MessagePlayer( "Your current skin: " + GetSkinName( player.Skin ), player );
          }
          else
          {
               MessagePlayer( "Syntax error! Please type: /c setskin SkinID" , player );
          }
     }
}

Notes

The functions MessagePlayer, GetSkinName, IsNum, tointeger() and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

List of skins: SkinIDs.

Related Functions

Personal tools
squirrel scripting