Before continuing, please make sure that your issue/crash has not been filed before on this forum. If it has, please provide additional information in the existing forum topic by filling out the template there.
To provide valuable feedback for OneSync issues or crashes, please fill out the following template as much as possible.
Client
Using canary?
Yes
Windows version:
Windows 10 latest
System specifications:
Not really relevant this isn’t a crash
Server
Operating system:
Windows 10 Latest Artifact version:
3975 IP address:
Home Testing Resources:
Development System specifications:
Not a crash report
Incident
Summary:
After having updated to the latest artifacts the one working system I had of spawning Peds using the server and manipulating them via the client is now broken. (I am coding in c#)
Expected behavior:
Creating a Ped on the server spawns the entity and assigns a network id. I then use this network id as identification on the client. Previously this has all worked fine. Peds on the server are available to the client in GetGamePool(“CPed”)
Actual behavior:
Since updating Peds are spawned objects on the server. Are no longer valid on the client and I get spammed with messages about the network ids no longer referencing valid objects (not sharing net ids anymore) Also GetGamePool(“CPed”) is never seeing the Peds either.
Steps to reproduce:
Write a client script that calls an event to the server to spawn an entity (await till its valid) call an event on the client to set attributes or tasks using NetworkGetEntityFromNetId (or whatever its called) to get the clients reference to the object. Check GetGamePool and see its empty Server/Client?
? Files for repro (if any):
Can be provided I guess Error screenshot (if any): .dmp files/report IDs:
Since you have the scripts you’re mentioning in your standalone repro, I wonder - why have you not shared them and left such as some sort of exercise to the reader?
Also, no server or client game state changes were even made on or after 3969, so something else seems to be missing in your deductions.
Something has changed previously the Peds would spawn with a Net Id in the 65k range since after this they are spawning in the range of 8k and any reference to that netid in the client seems to fail being valid.
I will just roll back the server to a version that worked.
int PedId = CreatePed(26, (uint)GetHashKey("u_m_y_zombie_01"), PosX, PosY, PosZ += 0.5f, 0, true, true);
while (DoesEntityExist(PedId) == false) { await Delay(50); } //wait for entity to exist on server...
await Delay(10);
int PedNetId = NetworkGetNetworkIdFromEntity(PedId);
int pId = NetworkGetEntityFromNetworkId(PedNetId);
Debug.WriteLine("Ped First Id: " + PedId + " Ped Net Id: " + PedNetId + " Ped From Net: " + pId);
Call an event to the client passing NetId
TriggerClientEvent("PedFinalize", PedNetId);
Server Messages showing valid creation
[38;5;113m[ script:zarp] Ped First Id: 137473 Ped Net Id: 8166 Ped From Net: 137473
[38;5;113m[ script:zarp] Ped First Id: 137217 Ped Net Id: 8167 Ped From Net: 137217
private void OnPedFinalize(int PedNetId)
{
int PedId = NetToPed(PedNetId); //comes back as null
//do stuff
}
Client Messages
[ 139672] [ GTAProcess] MainThrd/ GetNetworkObject: no object by ID 8166
[ 139672] [ GTAProcess] MainThrd/ GetNetworkObject: no object by ID 8167
Likely the case of the event executing before the network ID is registered on the client. To ensure this is a bug, in your client script would it also be possible to include the logic (in pseudocode):
void OnPedFinalize(int pedNetId) {
const var timeLimit = ... ;
var currentTime = GetGameTimer() ; // GetNetworkTimeAccurate
/*
* Wait until pedNetId is registered or some period of time has passed.
* Possibly use 'NetworkDoesEntityExistWithNetworkId' instead.
*/
while ((GetGameTimer() - currentTime) <= timeLimit && !NetworkDoesNetworkIdExist(pedNetId)) {
await Delay(0);
}
if (NetworkDoesNetworkIdExist(pedNetId))
ReportSuccess();
else
ReportFailure();
}
I have now attempted it with this waiting for a valid id. When using a set amount of time didn’t work I modified it in a do while. Minutes later still no valid id.
int currentTime = GetGameTimer(); // GetNetworkTimeAccurate
do
{
int time = GetGameTimer();
Debug.WriteLine("Current Net Time " + currentTime + "No Net Id Yet...WAITING:" + time);
await Delay(0);
} while (!NetworkDoesNetworkIdExist(PedNetId));
Client Log:
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 13664No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 13748No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 13748No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14152No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14152No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14269No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14417No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14417No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14607No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14607No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14835No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14835No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 14969No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15013No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15252No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15252No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15419No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15419No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15702No Net Id Yet…WAITING:174320
[ 222860] [ GTAProcess] MainThrd/ Current Net Time 15702No Net Id Yet…WAITING:174320
That sounds more like a configuration difference than a version difference, e.g. ‘beyond’ mode being disabled via disabling onesync_population or such.
Man I hope one of you are still active cause I’m having this issue peds it’s like all scenarios and 80% of the peds won’t spawn like gang peds on grove I’m going to try this hopefully it works cause my artifacts is wayyyyyyyyyy newer than this one