diff --git a/code/components/citizen-server-impl/src/state/ServerRPC.cpp b/code/components/citizen-server-impl/src/state/ServerRPC.cpp index 64297fb5c9..d26de641c6 100644 --- a/code/components/citizen-server-impl/src/state/ServerRPC.cpp +++ b/code/components/citizen-server-impl/src/state/ServerRPC.cpp @@ -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; } diff --git a/code/components/citizen-server-impl/src/state/ServerSetters.cpp b/code/components/citizen-server-impl/src/state/ServerSetters.cpp index 4426260c63..0672b01430 100644 --- a/code/components/citizen-server-impl/src/state/ServerSetters.cpp +++ b/code/components/citizen-server-impl/src/state/ServerSetters.cpp @@ -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; diff --git a/ext/native-decls/server/CreatePedServerSetter.md b/ext/native-decls/server/CreatePedServerSetter.md new file mode 100644 index 0000000000..79f909b326 --- /dev/null +++ b/ext/native-decls/server/CreatePedServerSetter.md @@ -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. \ No newline at end of file