SetPlayerSkin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Added an example)
Line 16: Line 16:
<syntaxhighlight lang="lua">  
<syntaxhighlight lang="lua">  
function enterTheLaw(playerSource)
function enterTheLaw(playerSource)
   if (getPlayerSkin(playersource) == 280) then
   if (getPlayerSkin(playerSource) == 280) then
     outputChatBox("You are already in the law!", playerSource)
     outputChatBox("You are already in the law!", playerSource)
   else
   else

Revision as of 22:11, 23 January 2008

This function changes the skin of a player.

Syntax

bool setPlayerSkin ( player thePlayer, int skinID )

Required Arguments

  • thePlayer: The player whose model will be changed.
  • skinID: A GTASA player model (skin) ID. See Character Skins.

Example

This example sets you a police skin when you type the command /law.

 
function enterTheLaw(playerSource)
  if (getPlayerSkin(playerSource) == 280) then
    outputChatBox("You are already in the law!", playerSource)
  else
    setPlayerSkin(playerSource, 280)
    outputChatBox("Welcome to the law, protect the innocents.", playerSource)
  end
end

addCommandHandler("law", enterTheLaw)

See Also