Closed makeloffve closed 2 years ago
try this one, maybe it can help a bit player.Player.teleportToLocationUnsafe(position, player.Rotation);
There is an event specifically for this: Provider.onLoginSpawning
There is an event specifically for this:
Provider.onLoginSpawning
Can I loop in thread onLoginSpawning? I need the player to spawn on the position bound by the button after clicking the custom effect button (different buttons are bound to different points) my code: in the thread onLoginSpawning loop detect button click. but will it affect the main thread of the game?
private void OnLoginSpawningHandler(SteamPlayerID playerID, ref Vector3 point, ref float yaw, ref EPlayerStance initialStance, ref bool needsNewSpawnpoint)
{
string teamName;
while (!GroupManager.PlayerTeamCache.TryGetValue(playerID.steamID.m_SteamID, out teamName))
{
Rocket.Core.Logging.Logger.Log("[OnLoginSpawningHandler] " + playerID.playerName + " loop 1s for waiting groupInfo");
Thread.Sleep(1000);
}
Rocket.Core.Logging.Logger.Log("[OnLoginSpawningHandler] " + playerID.playerName + " end loop!!!");
if (Configuration.Instance.EnableRespawnSpecialPoint)
{
RespawnPoint respawnPoint;
if (RespawnPointManger.Instance.RespawnPoints.TryGetValue(teamName, out respawnPoint))
{
point = new Vector3(respawnPoint.X, respawnPoint.Y, respawnPoint.Z);
needsNewSpawnpoint = true;
}
}
}
No, it will block the server. A better solution is to spawn the player in safezone and wait for him to choose then teleport him
No, it will block the server. A better solution is to spawn the player in safezone and wait for him to choose then teleport him
Yes, guess that all handlers run in a small and fixed thread pool, loop is forbidden
I want player to be born at the special location when he connected server instead of the location where the player left the server last time
I tried to call
player.Teleport
inonConnect
event, but teleport cannot work.code: