Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onShudownReceived () #370

Open
emlodnaor opened this issue Sep 26, 2024 · 4 comments
Open

onShudownReceived () #370

emlodnaor opened this issue Sep 26, 2024 · 4 comments
Labels
feature New feature or request

Comments

@emlodnaor
Copy link

emlodnaor commented Sep 26, 2024

Is your feature request related to a problem? Please describe.
I need to store information before the server shuts down, and I need to do it before players are kicked, so that information I need to store is still available

Describe the solution you'd like
once the server receive a shutdown instruction from anywhere, as it's first step it should trigger onShudownReceived(), time needs to be given to allow information to be stored to disk etc, maybe wait for all onShudownReceived functions to return, or somehow allow them to set a delay for the rest of the shutdown?

Describe alternatives you've considered
I could use a timer to store the information every now and then, but it feels dirty, and would never be perfect
a onPreKick might also do the trick

@emlodnaor emlodnaor added the feature New feature or request label Sep 26, 2024
@OfficialLambdax
Copy link
Collaborator

Im pretty sure this event already exists as onShutdown is described to be called when "Triggered when the server shuts down. Currently happens after all players were kicked.". But this is obviously called after the players where kicked, meaning you can save the data everytime a player is diconnected?

@emlodnaor
Copy link
Author

it does not seem to me that onPlayerDisconnect is triggered on server exit when the server kicks the players, but I could be wrong, I will do more testing later and report back...

@OfficialLambdax
Copy link
Collaborator

You are probably storing data in tables of your script state right? Meaning that once onShutdown has been called, you can just save these tables, the players are still in there if onPlayerDisconnect isnt called. Sure the server may kicked them already, meaning you cant send them events, but data would still be there

@emlodnaor
Copy link
Author

yes and no, I'm trying to avoid any sort of timer, and make it as light as possible, so I don't continuously update the tables, only on disconnect, and then I was planning to also do it when the server is shut down... so that's why I made this issue... but I can find a workaround, and it's not critical...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants