Player::setModel

From RAGE Multiplayer Wiki
Revision as of 22:04, 6 October 2024 by Caballero (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Client-Side
Function

 JavaScript



JavaScript Syntax


Required Params

  • modelName: string — The name of the model to be set for the player.

Return value

  • void — This function does not return a value.

Syntax

// Function to change the player's model
function changePlayerModel(modelName) {
    let player = mp.players.local; // Reference to the local player
    let modelHash = mp.game.joaat(modelName); // Get the model hash from the model name

    // Set the player's model
    player.model = modelHash; // Change the player's model

    // Notify the player
    mp.gui.chat.push("Your model has been changed to " + modelName + ".");
}

// Bind the function to a key (for example, the "E" key)
mp.keys.bind(69, false, function() { // 69 is the key code for "E"
    changePlayerModel('a_m_m_acult_01'); // Call the function to change the model
});


Available Models

See the list of available models: Peds


See also