Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Events.ObjectCreatedCallback cannot detect IPlayer

Did you encounter a problem, exploit, glitch or bug while playing the game or running the dedicated server software? Tell us about it here.
Forum rules
By using the forum you agree to the following rules. For this forum you also need to follow these additional rules.
Post Reply
NearHuscarl
Superfighter
Superfighter
Posts: 97
Joined: Thu Feb 07, 2019 4:36 am

Events.ObjectCreatedCallback cannot detect IPlayer

Post by NearHuscarl » Fri Mar 25, 2022 6:11 pm

I cannot use Events.ObjectCreatedCallback to detect whether a new player is spawned. Minimal code example:

Code: Select all

Events.ObjectCreatedCallback.Start(os =>
{
    foreach (var o in os)
    {
        if (o is IPlayer)
        {
            Game.WriteToConsole(o.Name);
        }
    }
});
By the way, I'd want to have a separate event to detect if a new player is spawned since I am not interested in listening to hundreds of other objects. Something like:

Code: Select all

Events.PlayerCreatedCallback.Start((IPlayer[] players) => { /* ... */ });
0 x
Image

Post Reply