The appearance of the player on the map

Brain

Member
Member
Dec 29, 2016
71
7
8
50
Parts Unknown
DreTaX - tell me , please, you need to check when the player appeared on the map when you connect to the server - it is possible?
If you do a search through Find you get errors if there is no player nullreferenceexception object reference not set.
Not interested in Fougerite.find - need right side of the engine
 
What?
What are you trying to find? A Player?
Or post part of your code so we have a rough idea where this error is coming from
 
What?
What are you trying to find? A Player?
Or post part of your code so we have a rough idea where this error is coming from
I need to check to see if the player on the map when you first connect to the server

if (PlayerClient.GetLocalPlayer().rootControllable.gameObject != null)
{
}
nullreferenceexception object reference not se
 
I need to check to see if the player on the map when you first connect to the server

if (PlayerClient.GetLocalPlayer().rootControllable.gameObject != null)
{
}
nullreferenceexception object reference not se
Probably throwing null because there is no player yet (Still connecting).
Try:
C#:
var obj = PlayerClient?.GetLocalPlayer()?.rootControllable?.gameObject?? null
if (obj != null)
{
    //Not null
}
 
Theres no player being checked in that function.
Thats why you are getting null errors

PlayerClient.GetLocalPlayer() Needs to be a playersclient.
E.G:
On_PlayerConnected(Player player, etc)
player.PlayerClient.rootcontrollable.etc..
 
Theres no player being checked in that function.
Thats why you are getting null errors

PlayerClient.GetLocalPlayer() Needs to be a playersclient.
E.G:
On_PlayerConnected(Player player, etc)
player.PlayerClient.rootcontrollable.etc..
How can I check?
 
Theres no player being checked in that function.
Thats why you are getting null errors

PlayerClient.GetLocalPlayer() Needs to be a playersclient.
E.G:
On_PlayerConnected(Player player, etc)
player.PlayerClient.rootcontrollable.etc..
the check is on the client , not the server
 
Client or Server?
If server, post your full function or PM it if you dont want it public
 
In client no On_PlayerConnected
So It throws null because the player didn't load yet?

Easy as this:

C#:
public void On_PlayerConnected(Fougerite.Player Player)
{
   DataStore.Add("CheckStuff", Player.UID, 1);
}

public void On_PlayerSpawned(Fougerite.Player player)
{
    if (DataStore.Get("CheckStuff", player.UID) != null)
    {
        DataStore.Remove("CheckStuff", player.UID);
        // todo do something
    }
}
 
So It throws null because the player didn't load yet?

Easy as this:

C#:
public void On_PlayerConnected(Fougerite.Player Player)
{
   DataStore.Add("CheckStuff", Player.UID, 1);
}

public void On_PlayerSpawned(Fougerite.Player player)
{
    if (DataStore.Get("CheckStuff", player.UID) != null)
    {
        DataStore.Remove("CheckStuff", player.UID);
        // todo do something
    }
}
I wrote it for the client - not the server check