public static int GetAFaceIndex(freemodeGender desiredGender) { int returnedIndex = 0; if (desiredGender == freemodeGender.any) { returnedIndex = RandoMath.CachedRandom.Next(numberOfFaceIndexes); } else if (desiredGender == freemodeGender.female) { returnedIndex = RandoMath.CachedRandom.Next(21, 43); if (returnedIndex == 42) { returnedIndex = 45; } } else { returnedIndex = RandoMath.CachedRandom.Next(0, 24); if (returnedIndex > 20) { returnedIndex += 21; } } return(returnedIndex); }
public static void SetPedFaceBlend(Ped targetPed) { freemodeGender pedGender = freemodeGender.any; if (targetPed.Model == PedHash.FreemodeMale01) { pedGender = freemodeGender.male; } else if (targetPed.Model == PedHash.FreemodeFemale01) { pedGender = freemodeGender.female; } else { UI.Notify(string.Concat("attempted face blending for invalid ped type: ", targetPed.Model)); } Function.Call(Hash.SET_PED_HEAD_BLEND_DATA, targetPed, GetAFaceIndex(pedGender), GetAFaceIndex(pedGender), 0, GetAFaceIndex(0), GetAFaceIndex(0), 0, 0.5f, 0.5f, 0, false); }