Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static InitFunction initFunction([]()
{
// deprecated by ServerSetters
#ifdef STATE_FIVE
if (native->GetName() == "CREATE_PED" || native->GetName() == "CREATE_OBJECT_NO_OFFSET")
if (native->GetName() == "CREATE_OBJECT_NO_OFFSET")
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ static InitFunction initFunction([]()
ctx.SetResult(guid);
});

fx::ScriptEngine::RegisterNativeHandler("CREATE_PED", [=](fx::ScriptContext& ctx)
fx::ScriptEngine::RegisterNativeHandler("CREATE_PED_SERVER_SETTER", [=](fx::ScriptContext& ctx)
{
uint32_t resourceHash = 0;

Expand Down
27 changes: 27 additions & 0 deletions ext/native-decls/server/CreatePedServerSetter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
ns: CFX
apiset: server
---
## CREATE_PED_SERVER_SETTER

```c
Ped CREATE_PED_SERVER_SETTER(int pedType, Hash modelHash, float x, float y, float z, float heading, BOOL isNetwork, BOOL bScriptHostPed);
```

Equivalent to CREATE_PED, but it uses 'server setter' logic as a workaround for
reliability concerns regarding entity creation RPC.

Creates a ped (biped character, pedestrian, actor) with the specified model at the specified position and heading.

## Parameters
* **pedType**: Unused. Peds get set to CIVMALE/CIVFEMALE/etc. no matter the value specified.
* **modelHash**: The model of ped to spawn.
* **x**: Spawn coordinate X component.
* **y**: Spawn coordinate Y component.
* **z**: Spawn coordinate Z component.
* **heading**: Heading to face towards, in degrees.
* **isNetwork**: Whether to create a network object for the ped. If false, the ped exists only locally.
* **bScriptHostPed**: Whether to register the ped as pinned to the script host in the R* network model.

## Return value
A script handle (fwScriptGuid index) for the ped, or `0` if the ped failed to be created.
Loading