Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

Detect when client exits server?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Detect when client exits server?

    Currently, when a player exits the server, their pawn dies after a short delay. I'd like to store their location and loadout instead. However I'm can't see to find where is dealing with the logic that currently kills the pawn.

    I know there is Logout() in GameInfo, but this seems to run after the pawn has been killed.

    Any help would be much appreciated.

    #2
    Logout is called for a player when the controller has been (/going to be) destroyed. If you have a custom controller class you can use that method.

    Code:
    class MyController extends AnyPlayerController;
    
    simulated event Destroyed()
    {
        if (Role == ROLE_AUTHORITY)
        {
            // do the work for storing loadout etc.
        }
    
        // PlayerController::Destroyed will actually kill the Pawn with CleanupPawn() if there is a valid Pawn
        super.Destroyed();
    }
    The PlayerController is destroyed from the LocalPlayer natively on disconnect.

    Comment


      #3
      Thanks, that does appear to do the trick. There seems to around a ~20 second delay before the server destroys the controller. I'm curious what is triggering the Destroy() on the controller. Any ideas?

      Comment


        #4
        Probably the PlayerControllers time out and are not destroyed directly. You might try to replicate the event when the controller is destroyed on the client side back to the server. NotifyGameSessionEnded could be useful in that case.

        Comment


          #5
          Yeah that's not a bad idea. However part of why I want catch this event on the server is if the client crashes. Unfortunately I have a mysterious crash that happens every 3-4 hours. So i want to ensure the player's position and loadout is intact for them to rejoin.

          Comment

          Working...
          X