Server is no-longer getting object ownership

Client

Using canary? No
Windows version: Microsoft Windows 10 Pro (Version 10.0.19041 Build 19041)
System specifications:
Processor: AMD Ryzen 7 3700X 8-Core Processor, 3593 Mhz, 8 Core(s), 16 Logical Processor(s)
Memory: 16.0 GB
Graphics Card: NVIDIA GeForce GTX 1080 Ti

Server

Operating system: Microsoft Windows 10 Pro (Version 10.0.19041 Build 19041)
Artifact version: FXServer-master SERVER v1.0.0.3397
IP address: Local Test Server
Resources:
System specifications:

Incident

Summary:
Server is no-longer getting ownership when player is far away from object that spawn from the server-side, Causing object to be deleted.

Steps to reproduce:

  • Spawn object server-side using CreateObjectNoOffset.
  • Drive/Fly/Walk away from until object disappear.

Server/Client? Server

Any additional info:

  • Can’t reproduce this behavior with FXServer version 3383
  • Videos with network object viewer:
1 Like

Hey, I came across the same issue. Here are my results after testing a bit:

Client

Using canary? Yes
Windows Version: Windows 10 Pro 20H2

Server

Operating System: Windows (artifact 3431) and Linux (artifact 3435)
Windows was localhost, Linux was remote server
Resources: only default resources and my test resource. Link below.
Game Build: 2189 and default

Incident

Steps to reproduce

  • Objects gets spawned by the server via CreateObjectNoOffset
  • The Object appears at the specified location.
  • If the client leaves the area, the object disappears.

Maybe important info:

  • The client shows missionEntity=false for the server-sided spawned entity.
  • The Lod of the Object can be edited by the client with SetEntityLodDist, but the Lod doesn’t change.
  • FXServer version 3383 doesn’t have the bug, and even the Lod Distance can be changed.
  • In the latest server artifact versions (see version above), the object disappears at a much lower range. In 3383 the distance before the object is unloaded for me is much higher.

My test resource (Download Link at the end)

Client

let latestObject = 0;

onNet("test:newobject", function (networkId) {
  latestObject = networkId;
})

setInterval(function () {
  if (latestObject) {
    let entity = NetworkGetEntityFromNetworkId(latestObject);
    let networkIdExists = NetworkDoesNetworkIdExist(latestObject);

    showTextOnScreen("networkId: " + latestObject + ", entity: " + entity + ", networkIdExists: " + networkIdExists, 0.2, 0.2);
  }
}, 1);

function showTextOnScreen(text, x, y) {
  SetTextFont(0)
  SetTextProportional(1)
  SetTextScale(0.0, 0.4)
  SetTextColour(255, 255, 255, 255)
  SetTextDropshadow(0, 0, 0, 0, 255)
  SetTextEdge(1, 0, 0, 0, 255)
  SetTextDropShadow()
  SetTextOutline()
  SetTextEntry("STRING")
  AddTextComponentString(text);
  DrawText(x, y)
}

Server

RegisterCommand("spawn", async function (source, args) {
  let ped = GetPlayerPed(source);
  let coords = GetEntityCoords(ped);
  let object = CreateObjectNoOffset("prop_barrier_work06a", coords[0], coords[1], coords[2], true, true, true);

  let i = 0;
  while (!DoesEntityExist(object) && i++ < 100) {
    await Delay(1);
  }
  if (!DoesEntityExist(object)) {
    console.log("couldn't create object.");
    return;
  }

  let networkId = NetworkGetNetworkIdFromEntity(object);
  console.log("created object " + object + " with networkId " + networkId);
  emitNet("test:newobject", -1, networkId);
})

Video

Test-Resource
objecttest.zip (1.5 KB)

1 Like

Odd - maybe whatever happened in 4cbf129072fd2a93e0e854def4d5057508c96ceb (feat(gamestate/server): new-improved CREATE_PED and CREATE_OBJECT_NO_… · citizenfx/fivem@4cbf129 · GitHub) isn’t setting the script data node correctly?

Seen multiple reports of this since, didn’t see this topic likely as it got drowned in other posts, sorry. :frowning:

1 Like

Should be fixed! Server-spawned objects were set as ‘Created By’ ID ‘1’, which is apparently ENTITY_OWNEDBY_TEMP :frowning:

6 Likes

Just tested it on artifact 3524, works great! Thank you.

Hi, It seems that this problem now also persists when reconnecting to the server.

When I restart the client completely the object is visible again.