Hello guys, I’m trying to make the code the most clean possible by correctly handling server and client.
I just don’t understand why player.Character is null on the server script, onesync is set on “on” (with +set onesync on).
This is the event on the server script:
private void ServerPlayerRequestLocation([FromSource] Player source, string locationName)
{
Location location = Database.GetLocation(locationName);
if (location == null) return;
source.Character.Position = new Vector3((float)location.X, (float)location.Y, (float)location.Z);
source.Character.Heading = (float)location.Heading;
}
And this is the client triggering the event:
private void OnPlayerSpawned(object spawnInfo)
{
TriggerServerEvent("vspeedserver:playerRequestLocation", "Garage");
}
The “source” works correctly and everything is good, it’s just the “Character” that is null, I repeat that onesync is +set on!