SetPlayerSkin: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
__NOTOC__  
{{Client function}}
Changes the model (skin) of a player
__NOTOC__
Changes the model (skin) of a player.


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


===Required Arguments===  
===Required Arguments===  
*'''Player:''' Refers to a player whos model (skin) ID will be changed.
*'''thePlayer:''' Refers to a player whose model (skin) ID will be changed.
*'''ID:''': A GTASA player model (skin) ID. Link below to all valid GTASA model (skin) IDs.
*'''id:''' A GTASA player model (skin) ID. List of [[Character Skins]]


==Example==  
==Example==  
Explain what the example does here
This code will apply a random skin to a player each time he spawns.
<syntaxhighlight lang="lua">root = getRootElement ()
<syntaxhighlight lang="lua">
addEventHandler ( "onSpawnpointUse", root, "onSpawnpointUse" )
function onSpawnpointUse ( spawnedplayer )               -- When a player uses a maps spawnpoint
function onSpawnpointUse ( player ) --When a player uses a maps spawnpoint
    setPlayerSkin ( spawnedplayer, randInt ( 10, 100 ) ) -- Set the spawned player's skin to a random number between 10 and 100
setPlayerSkin ( player, randInt ( 10, 100 ) ) --Set the joined player's skin to a random number between 10 and 100
end
end</syntaxhighlight>
addEventHandler ( "onSpawnpointUse", getRootElement ( ), onSpawnpointUse )
</syntaxhighlight>


==See Also==
==See Also==

Revision as of 21:58, 15 August 2007

Changes the model (skin) of a player.

Syntax

bool setPlayerSkin ( player thePlayer, int id )

Required Arguments

  • thePlayer: Refers to a player whose model (skin) ID will be changed.
  • id: A GTASA player model (skin) ID. List of Character Skins

Example

This code will apply a random skin to a player each time he spawns.

function onSpawnpointUse ( spawnedplayer )                -- When a player uses a maps spawnpoint
    setPlayerSkin ( spawnedplayer, randInt ( 10, 100 ) )  -- Set the spawned player's skin to a random number between 10 and 100
end
addEventHandler ( "onSpawnpointUse", getRootElement ( ), onSpawnpointUse )

See Also

GTASA IDs (vehicles, weapons, weathers, characters, colors): http://info.vces.net/ (Special thanks to Brophy and Ratt for making these lists)