Log in to reply

Spawning a Streamed ped with a hotkey c++

  • Trying to spawn a streamed add-on ped I put together with a keyboard hotkey, but whenever the hotkey is hit, it spawns the model completely invisible, as in none of the assets are applied to it(clothing skins etc) Like it spawned the base skeleton rigging of the model but none of the pieces.

    It can be fixed using a trainer(by setting to default wardrobe) but it's inconvenient to have to do, and players new to modding have issues.

    I feel like this is an easy fix, what's missing? or is the problem just the ped model I'm using and not the scripting?

    using GTA;
    using System;
    using System.Windows.Forms;

    public class ChangePlrModel : Script
    Keys changeModelKey = Keys.V;
    Model modelToChangeTo = "PEDMODELNAMEHERE";

    public ChangePlrModel()
    	KeyDown += ChangePlrModel_KeyDown;
    private void ChangePlrModel_KeyDown(object sender, KeyEventArgs e)
    	if (e.KeyCode == changeModelKey)


    It's for this mod: https://www.gta5-mods.com/scripts/jesus-christ-mod

  • Try Game.Player.Character.SetDefaultClothes() after changing your model.

  • @NotOfTheWorld If you want to customize your ped at spawn, you can also do something like this (streaming or normal ped).

    Assuming Jesus is customizable that is. There are 12 components (0 to 11) and also Props as well. This is C# not C++ although I wouldn't know the difference.

          // Ped PP = Game.Player.Character;  if you want cleaner code
            Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 0, 0, 1, 2); //head
            Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 1, 1, 0, 2); // beard
            Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 2, 3, 0, 2); // hair
            Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 3, 22, 5, 2); //torso, jacket
            Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 4, 0, 2, 2); //jeans
            Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character, 6, 9, 0, 2); //shoes
            Function.Call(Hash.SET_PED_**PROP_INDEX**, Game.Player.Character, 1, 3, 1, 2); //Glasses`

    If you want a spawn rather than a change:
    Ped Dante = World.CreatePed(PedHash.Trevor, Game.Player.Character.GetOffsetPosition(new Vector3(1, 5, 0)));

    @Jitnaught : I apologize if I'm old school, usually go for the native function because when I started playing with scripts that's the only documentation I could find.

  • @Jitnaught said in Spawning a Streamed ped with a hotkey c++:


    Hi. I'm not that familiar with SHVDN functions, but this is DN2 right?
    Not sure what the function would be DN3?

    or just
    Function.Call(Hash.SET_PED_DEFAULT_COMPONENT_VARIATION, Game.Player.Character);

  • This post is deleted!

Log in to reply

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.