Skip to content

OnPlayerRespawn

Usage

  • Return TYPE to prevent default behavior

Example Autogenerated

csharp
private void OnPlayerRespawn( BasePlayer instance, SpawnPoint spawnPoint )
{
    Puts( "OnPlayerRespawn works!" );
}
csharp
private void OnPlayerRespawn( BasePlayer player, SleepingBag sleepingBag2 )
{
    Puts( "OnPlayerRespawn works!" );
}

Location

  • BasePlayer::Respawn()
  • SleepingBag::SpawnPlayer(BasePlayer player, NetworkableId sleepingBag)
csharp
//---
	BasePlayer.SpawnPoint spawnPoint = ServerMgr.FindSpawnPoint(this);
	if (ConVar.Server.respawnAtDeathPosition && this.ServerCurrentDeathNote != null)
	{
		spawnPoint.pos = this.ServerCurrentDeathNote.worldPosition;
	}
	object returnvar = Interface.CallHook("OnPlayerRespawn", this, spawnPoint);
	if (returnvar is BasePlayer.SpawnPoint)
	{
		spawnPoint = (BasePlayer.SpawnPoint)returnvar;
	}
	this.RespawnAt(spawnPoint.pos, spawnPoint.rot, null);
//---
csharp
//---
	SleepingBag sleepingBag2 = array.FirstOrDefault((SleepingBag x) => x.ValidForPlayer(player.userID, false) && x.net.ID == sleepingBag && x.unlockTime < Time.realtimeSinceStartup);
	if (sleepingBag2 == null)
	{
		return false;
	}
	object returnvar = Interface.CallHook("OnPlayerRespawn", player2, sleepingBag2);
	if (returnvar is SleepingBag)
	{
		sleepingBag2 = (SleepingBag)returnvar;
	}
	if (sleepingBag2.GetRespawnState(player.userID) != RespawnInformation.SpawnOptions.RespawnState.OK)
//---

Released under the MIT License.