FivePD API
EntityWrappers/PedWrapper

FPedBuilder

Builder class for creating FPed instances with configurable properties.

Methods

WithWarrantsOptions

Options for the method.

Parameters

NameTypeDescription
WarrantsList<string>The warrants to use.
IncludeAllboolSpecifies whether to include all warrants. It should be true only when ped history is loaded. Does not respect and .
ChanceForAnyWarrantintThe chance for any warrant to be included.
MaxWarrantsintThe maximum number of warrants to include.

WithPedData

Sets the PedData for this ped.

Parameters

NameTypeDescription
pedDataPedDataThe PedData to associate with this ped.

Returns

NameType
FPedBuilderThe current builder instance.

WithOwningVehicleNetworkId

Sets the id of the vehicle the ped is owning.

Parameters

NameTypeDescription
vehicleNetworkIdintThe network ID of the vehicle to assign.

Returns

NameType
FPedBuilderThe current builder instance.

WithFirstname

Sets the firstname of the ped.

Parameters

NameTypeDescription
namestringThe first name to set.

Returns

NameType
FPedBuilderThe current builder instance.

WithFirstname

Sets a random firstname for the ped from a provided list.

Parameters

NameTypeDescription
namesList<string>The list of possible first names to choose from.

Returns

NameType
FPedBuilderThe current builder instance.

WithLastname

Sets the lastname of the ped.

Parameters

NameTypeDescription
namestringThe last name to set.

Returns

NameType
FPedBuilderThe current builder instance.

WithLastname

Sets a random lastname for the ped from a provided list.

Parameters

NameTypeDescription
namesList<string>The list of possible last names to choose from.

Returns

NameType
FPedBuilderThe current builder instance.

WithBirthdate

Sets a random birthdate for the ped between 1960 and 2004.

Returns

NameType
FPedBuilderThe current builder instance.

WithBirthdate

Sets the birthdate of the ped.

Parameters

NameTypeDescription
birthdateDateTimeThe birthdate to set.

Returns

NameType
FPedBuilderThe current builder instance.

WithItems

Selects and sets a random set of items for the ped.

Parameters

NameTypeDescription
itemsIEnumerable<Item>The collection of possible items to choose from.
includeAllboolWhen true, includes all items. When false, selects a random subset.

Returns

NameType
FPedBuilderThe current builder instance.

WithWarrants

Sets the warrants for the ped according to the specified options.

Parameters

NameTypeDescription
optionsWithWarrantsOptionsConfiguration options for warrant assignment.

Returns

NameType
FPedBuilderThe current builder instance.

WithLicense

Adds a single license to the ped if they don't already have one of the same type.

Parameters

NameTypeDescription
pedLicensePedLicenseThe license to add.

Returns

NameType
FPedBuilderThe current builder instance.

WithLicenses

Adds multiple licenses to the ped, skipping any license types the ped already has.

Parameters

NameTypeDescription
licensesIEnumerable<PedLicense>The collection of licenses to add.

Returns

NameType
FPedBuilderThe current builder instance.

WithAlcoholLevel

Sets a specific alcohol level for the ped.

Parameters

NameTypeDescription
alcoholLeveldoubleThe alcohol level to set.

Returns

NameType
FPedBuilderThe current builder instance.

WithAlcoholLevel

Sets a random alcohol level for the ped based on the provided configuration.

Parameters

NameTypeDescription
alcoholConfigAlcoholConfigThe configuration defining alcohol level probabilities and limits.

Returns

NameType
FPedBuilderThe current builder instance.

WithDrugs

Adds a collection of drugs to the ped's inventory.

Parameters

NameTypeDescription
drugsIEnumerable<Drug>The drugs to add.

Returns

NameType
FPedBuilderThe current builder instance.

WithDrugs

Randomly adds drugs to the ped based on the provided configurations.

Parameters

NameTypeDescription
drugsConfigList<DrugConfig>The configuration defining drug probabilities.

Returns

NameType
FPedBuilderThe current builder instance.

WithRandomLicenses

Randomly assigns licenses to the ped based on the provided configuration.

Parameters

NameTypeDescription
pedLicensesConfigPedLicensesConfigThe configuration defining license types and probabilities.

Returns

NameType
FPedBuilderThe current builder instance.

Build

Creates a new FPed instance using the configured properties.

Returns

NameType
FPedA new FPed instance.

Properties

PedDataId

Gets the PedHistory id.

Type: int

Licenses

Gets the licenses of the ped.

Type: List<PedLicense>

Drugs

Gets the drugs of the ped.

Type: List<Drug>