Jump to content

i see when player disconnected in arena he still and arena not get kicked from arena

Closed 1.0.141 1.0.144

it's only Kicked me from event but not get me tp out to Spawn me in the lobby when i connected i hope u know what i mean i just need player be in lobby when they disconnected from event to spawn back to the lobby but don't let him be sleep let him be like frist time he join server and he spawn on lobby that will be good thanks for great job.!

Share this comment


Link to comment

        object OnPlayerRespawn(BasePlayer player)
        {
            if (player == null || player.IsNpc)
                return null;
            Vector3? spawnPoint = Interface.Call(nameof(IAdvancedLobby.HandleOnPlayerRespawn), player) as Vector3?;
            if (!spawnPoint.HasValue)
            {
                var spawnPointData = GetSpawnPoint(player);
                if (spawnPointData == null)
                    return null;
                spawnPoint = spawnPointData.Item1;
            }

            if (!spawnPoint.HasValue)
            {
                return null;
            }

            return new BasePlayer.SpawnPoint { pos = spawnPoint.Value, rot = new Quaternion(0, 0, 0, 1) };
        }

 

public void TeleportToLobby(BasePlayer player, int lobbyId, Vector3 destination)
        {
            if (player == null || player.IsNpc || destination.Equals(Vector3.zero))
                return;

            Lobby destinationLobby;
            if (Lobbies.TryGetValue(lobbyId, out destinationLobby) && destinationLobby != null)
            {
                if ((!destinationLobby.Data.RestrictAccess || destinationLobby.Data.AllowedPlayers.Contains(player.userID))
                    && !destinationLobby.Data.BannedPlayers.Contains(player.userID))
                {
                    RemoveFromLobbies(player);
                    destinationLobby.ActivePlayers.Add(new LobbyPlayer(player));
                    GiveLoadout(player, destinationLobby.Data.LoadoutName);
                    ResetPlayer(player);
                    Teleport(player, destination);
                    Ui.ClearAllMenus(player);
                    return;
                }
                ShowMessage(player, Messages.LobbyNoAccess, this);
            }
            ShowMessage(player, Messages.LobbyNotFound, this);
        }

 

        private void OnPlayerConnected(BasePlayer player)
        {
            if (player == null || player.IsNpc)
                return;
            if (!permission.UserHasPermission(player.UserIDString, PermissionIgnore))
                player.inventory.containerWear.SetLocked(true);

            var spawnPoint = GetSpawnPoint(player);
            if (spawnPoint?.Item1 != null)
            {
                TeleportToLobby(player, spawnPoint.Item2, spawnPoint.Item1.Value);
            }
            UpdatePlayerProfileImage(player.userID);
        }

i have this in other plugin have same u need to do if that will helps you 

Share this comment


Link to comment

        void OnPlayerDisconnected(BasePlayer player, string reason)
        {
            RemoveFromLobbies(player);
            if (!player.IsDestroyed)
                player.Kill();
        }

Share this comment


Link to comment

Im currently working to fix that one

So, if you connect to the server/leave a match, you will spawn in the middle of the map anyways?
Also, the crash problem/error code, appears when you get near or inside the lobby zone of the bedwars or the plugin you're using? 

Share this comment


Link to comment

Plugin updated, please let me know if that works now, also, try to test without any other that can modify the player teleport onconnect / die / disconnect and/or another lobby, that may cause some errors too
if you encounter any error or this update doesn't work for you, just reply here and i'll take a look at it

Sorry for the late update, i was having problems with other plugin too

Share this comment


Link to comment
1.1m

Downloads

Total number of downloads.

5.7k

Customers

Total customers served.

83.7k

Files Sold

Total number of files sold.

1.6m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.