SetPlayerSkin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(10 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{Needs_Checking|Broke I think--[[User:Ransom|Ransom]] 22:22, 10 September 2007 (CDT)}}
{{Server client function}}
__NOTOC__
{{Deprecated|setElementModel}}


{{Client function}}
This function changes the skin of a player.
__NOTOC__
Changes the model (skin) of a player.


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">bool setPlayerSkin ( player thePlayer, int id )</syntaxhighlight>  
<syntaxhighlight lang="lua">
bool setPlayerSkin ( player thePlayer, int skinID )
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''thePlayer:''' Refers to a player whose model (skin) ID will be changed.
*'''thePlayer:''' The [[player]] whose model will be changed.
*'''id:''' A GTASA player model (skin) ID. List of [[Character Skins]]
*'''skinID:''' A GTASA player model (skin) ID. See [[Character Skins]].


==Example==  
==Example==  
This code will apply a random skin to a player each time he spawns.
This example sets you a police skin when you type the command /law.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">  
function onSpawnpointUse ( spawnedplayer )               -- When a player uses a maps spawnpoint
function enterTheLaw(playerSource)
     setPlayerSkin ( spawnedplayer, randInt ( 10, 100 ) )  -- Set the spawned player's skin to a random number between 10 and 100
  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
end
addEventHandler ( "onSpawnpointUse", getRootElement ( ), onSpawnpointUse )
 
addCommandHandler("law", enterTheLaw)
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{IDs}}
{{Player functions}}
{{Player functions}}

Latest revision as of 09:10, 9 November 2018


Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use setElementModel instead.


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