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