SetPedType

We have GetPedType and SetPedAsCop but there is no other way to set a ped to any of the other ped types.

It would be nice to be able to set ped’s as the other ped types.

This is the first param of CreatePed

What about setting the ped type of a player though?

define the type in the first argument, see the types below:

{  
	PED_TYPE_PLAYER_0,// michael  
	PED_TYPE_PLAYER_1,// franklin  
	PED_TYPE_NETWORK_PLAYER,	// mp character  
	PED_TYPE_PLAYER_2,// trevor  
	PED_TYPE_CIVMALE,  
	PED_TYPE_CIVFEMALE,  
	PED_TYPE_COP,  
	PED_TYPE_GANG_ALBANIAN,  
	PED_TYPE_GANG_BIKER_1,  
	PED_TYPE_GANG_BIKER_2,  
	PED_TYPE_GANG_ITALIAN,  
	PED_TYPE_GANG_RUSSIAN,  
	PED_TYPE_GANG_RUSSIAN_2,  
	PED_TYPE_GANG_IRISH,  
	PED_TYPE_GANG_JAMAICAN,  
	PED_TYPE_GANG_AFRICAN_AMERICAN,  
	PED_TYPE_GANG_KOREAN,  
	PED_TYPE_GANG_CHINESE_JAPANESE,  
	PED_TYPE_GANG_PUERTO_RICAN,  
	PED_TYPE_DEALER,  
	PED_TYPE_MEDIC,  
	PED_TYPE_FIREMAN,  
	PED_TYPE_CRIMINAL,  
	PED_TYPE_BUM,  
	PED_TYPE_PROSTITUTE,  
	PED_TYPE_SPECIAL,  
	PED_TYPE_MISSION,  
	PED_TYPE_SWAT,  
	PED_TYPE_ANIMAL,  
	PED_TYPE_ARMY  
};

… what about for a player

What are you expecting changing the ped type to do?

Well at the moment I’m kind of using the SetPedAsCop for letting them into cop vehicles and access armoury but I could do it so it is based on their job.

Just ped type is an easier way it seemed

I would also like to see this, as currently when changing models or changing your player ped you will not change ped type. If it does change it will change to the MP ped type (2), For example, your player ped type controls how the game actually treats your ped, you would actually have correct hud colour for your character, speech, ringtone, and gender.

2 Likes

… state bags?

What?

HUD color is controlled by some native too (see GTAO Lamar missions) and other than that only defined for PLAYER_ZERO/… models - not ped type! - speech isn’t a thing in network mode and has nothing to do with ped type either, also “ringtone and gender”, huh?

un-related but could you help with Custom police car - sirens not working? - FiveM Resource Development & Modding / Discussion - Cfx.re Community ?

Have a ped that is ped type 0 (Michael) and use PlayPedRingtone(MichaelPed, “PHONE_GENERIC_RING_01”, 1) you will see that is Michaels ringtone. When you Set your model to Michael or use ChangePlayerPed, and play the same ringtone it will the play freemode one, because you it sets you to the MP Ped type, I verified this when playing as ped type 0 you will have the ringtones of said character. The game gets the peds gender from the ped type, and when it’s the mp ped type your gender would always be male (IsPedMale(ped)), also tested and its depending on your ped type, being ped type 0 sets your hud colour to Michael’s.

ah yeah, how did you “verify playing as ped type” then, given the claim that there’s no setter for ped type?

these things are tied to model or other ped metadata + global network flag, NOT the ped type.

Change player ped while not in a netgame and rejoin (bail from netgame and rejoin with natives)

what?

also, again, may be related to lots of other things, don’t say it’s the ped type when you’re not even sure of it, please.

also, each of these things can be changed even without doing anything to ped types, and that would make more sense and have less silly side effects.

I am sure that is it the ped type, before FiveM disabled loading your singleplayer save it would set your ped type as said character and you would have all the things i described. Having a ped type 0 gives you Michaels Hud Colour, Ringtone, Pausemenu Effects, Switch fx , cause the game actually thinks your Michael cause your ped type is Michael’s. ChangePlayerPed makes your new ped type the same as your last ped type, and if it was michael’s you will see that the ped that has the pedtype 0 will be treated like michael

Then what did you use to end up with that conclusion, given that the ped type may just be another effect of the same, yet unknown thus far thing that enables all those other things you named?

Nothing in your hypothesis rules out the case where the ped type is another result just like the ring tone, initial HUD color and other such items.

Unrelatedly to the original hypothesis, SP save loading may have affected things such as player ped health, but the HUD color has had nothing to do with SP save data loading, as it was set to the MP one long before that was patched out.

Your Char Hud Colour is tied to ped type. Michael (Hud Colour Num: 143) Franklin (Hud Colour Num: 145) Trevor (Hud Colour Num: 144) Freemode (Hud Colour Num: 116) your ped type will change it. Again though Using ChangePlayerPed() when your current ped is the ped type 0, and switch to franklin idk, Franklin will now have michaels ped type, have his hud colour, his phone ringtones, his switch screen fx, his pausemenu fx, until you use ChangePlayerModel.

Again, what are you using to come to that conclusion?

You’re saying that A → B, when it may very well be X → A and X → B, and not providing any reasons to counter that hypothesis.

… for one, character color is set from a function somewhat as follows:

  v1 = getCurrentStatIndex();
  v2 = getHudColourForStatIndex(v1);
  g_currentCharacterColour = v2;
  if ( scaleformSetupFunction(g_hud, 2, (__int64)"SET_CHARACTER_COLOUR", -1, -1) )
  {
    scaleformPushInt(v2);
    scaleformCall(0, *(__int64 *)&a1);
  }

This stat index, again, has zero relationship to the ped type, as it’s the index of the current character used for saving: 0/1/2 for SP, and 3/4/5/6/7 for MP:

  result = getPlayerTypeIndexFromPed(a1);
  // ...
  g_currentStatIndex = result;
int getPlayerTypeIndexFromPed(__int64 a1)
{
  int result = -1;
  if ( a1 )
    a1 = a1->archetype;
  if ( a1 )
  {
    v2 = a1->hash;
    if ( v2 == hash_player_zero )
    {
      result = 0i64;
    }
    else if ( v2 == hash_player_one )
    {
      result = 1i64;
    }
    else if ( v2 == hash_player_two )
    {
      result = 2i64;
    }
    else if ( mpSaveLoaded )
    {
      result = (unsigned int)getCurrentMPCharacterIndex() + 3;
    }
  }
  return result;
}