respawn players?

Post Reply
User avatar
AiTechEye
Member
Posts: 1000
Joined: Fri May 29, 2015 21:14
GitHub: AiTechEye
Location: Sweden

respawn players?

by AiTechEye » Post

A simple way to respawn players like:

player:respawn()

and with or without static spawn point
player:move_to_spawn()

very needed when you need to move a player away.
like the player "disappear", eaten, maybe move from a protected area...

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: respawn players?

by SuperStarSonic » Post

This would be very helpful, please look into this developers.

User avatar
Blockhead
Member
Posts: 1688
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: respawn players?

by Blockhead » Post

SuperStarSonic wrote:
Wed Dec 13, 2023 02:39
This would be very helpful, please look into this developers.
It was already added in 5.6.0-dev
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: respawn players?

by SuperStarSonic » Post

why does respawning using player:respawn() keep player velocity? It should reset it, do you know of any workaround?

User avatar
Blockhead
Member
Posts: 1688
Joined: Wed Jul 17, 2019 10:14
GitHub: Montandalar
IRC: Blockhead256
In-game: Blockhead Blockhead256
Location: Land Down Under
Contact:

Re: respawn players?

by Blockhead » Post

SuperStarSonic wrote:
Wed Dec 13, 2023 21:42
why does respawning using player:respawn() keep player velocity? It should reset it, do you know of any workaround?
I don't know why it does that, but it's not hard to work around. Just set the player's velocity. From a quick look at the docs you can't use :set_velocity() on players, but it's okay, you can get the player's velocity, negate x, y and z, then use :add_velocity().
/˳˳_˳˳]_[˳˳_˳˳]_[˳˳_˳˳\ Advtrains enthusiast | My map: Noah's Railyard | My Content on ContentDB ✝️♂

User avatar
SuperStarSonic
Member
Posts: 160
Joined: Fri Oct 14, 2022 20:30
GitHub: Python-Sargent
In-game: SuperStarSonic
Location: Earth (may be out of date)

Re: respawn players?

by SuperStarSonic » Post

I've fixed it so far by doing this:

Code: Select all

player:add_player_velocity(-player:get_velocity())

Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests