Is your feature request related to a problem? Please describe.
Not directly.
Describe the solution you'd like
It could be a useful idea to make a question dialog in which we ask the player before quitting the server whether he is sure to leave or not a little similar to https://github.com/myudev/samp-graceful-exit ??
You know when you're moving fast and writing something without attention then you get mistaken to any random stuff like quitting
and I know that what about cancelling regular action of /quit command and replacing it ? mightn't be a good idea since it might be used against the player itself(like keeping him stuck in-game without quitting)...
Which could be safely done by: it could be done by just adding some conditions to check for the packet where it tells where the Player has agreed to that question or not without any hard coding on the lua's side so that the developer has nothing to do except to enable/disable this feature in mtaconfig.xml
Additional context
https://discord.com/channels/278474088903606273/278474088903606273/775166798768504832
https://discord.com/channels/278474088903606273/278474088903606273/775169921750532126
https://discord.com/channels/278474088903606273/278474088903606273/775171037063151636
https://discord.com/channels/278474088903606273/278474088903606273/775175130492960818
https://discord.com/channels/278474088903606273/278474088903606273/775175399634239528
https://github.com/myudev/samp-graceful-exit (just example)
MTA already has the server-side onPlayerQuit event that is triggered whenever a player leaves the server, for every possible reason. That event is the ideal place to commit or rollback any player-related transactions to a database as a last resort.
On the other hand, about the actual functionality of asking players for confirmation to leave a server, I think that it could work like this:
A script calls a client-side function like requestDisconnectConfirmation(string reason), which asks MTA to show a confirmation message with the specified reason when the player tries to disconnect by graceful means (e.g. the main menu, Alt + F4 or the quit command). I think it would be nice that this function could be called several times, adding the different reasons to a case-insensitive set, so that MTA shows the confirmation whenever there is at least one reason in that set. A companion dismissDisconnectConfirmation([string reason]) function should be provided, that either empties the set of reasons to ask confirmation (if the reason is not provided) or removes the specified reason from the set. To prevent abuse of the requestDisconnectConfirmation function, I'd empty the set when the confirmation dialog is shown, before firing a onClientDisconnectAttempt event (so that a script can insist a bit on asking confirmation if it is doing something really worth it), and add a checkbox to suppress the message when it is shown more than once for a same server in the same session (like web browsers do when a web page abuses alert()).
In my opinion, if we were ever to implement a quit confirmation dialog, we'd want the client to have control of whether this appears or not (in the MTA general settings for example). It shouldn't be controlled by the server, in any way.
If a game asks me if I'm sure I want to quit, it's just annoying. Yes, I want to quit - I've managed to press possibly several keys then put my cursor over the Quit button and click on it. That doesn't happen by mistake.
How many times have I accidentally disconnected from a server in 15+ years of playing MTA? None.
The only way I can genuinely see that you accidentally disconnect, is if your last console command was quit (when you think it's something else) then you open the console and press Arrow Up (to bring up the last entered command) and quickly hit enter. That's just unlucky. I don't think it justifies this feature.
As for @AlexTMjugador's solution, I'm not sure why the server would need multiple reasons for the quit confirmation, or even have a custom message in the first place. There's possible room for abuse by having a custom message.
I agree with Lpsd. @Zorono please can you explain the exact problem you are trying to solve.
As for @AlexTMjugador's solution, I'm not sure why the server would need multiple reasons for the quit confirmation, or even have a custom message in the first place. There's possible room for abuse by having a custom message.
@Lpsd About MTA storing multiple reasons in a set, I thought that would be useful in case several resources wanted to ask the player for confirmation at the same time, so they can then dismiss their own request when they feel like it is no longer necessary, and the players get to see all the reasons they should not leave without thinking if they try. About the message, of course I wouldn't let a server show an entirely custom text; I would format it and maybe restrict it to a short and simple string, like this:
The server you are playing on requests that you confirm leaving it because of this reason:
(reason)
Are you sure you want to quit anyway?
On the other hand, I agree with the point that showing a confirmation message is mostly annoying, and that disconnecting from a server is not that easy to do on accident. However, if well used, this feature could be valuable in competitive scenarios. For example, many gamemodes already penalize players for logging out when they are in the middle of a combat, so a function like this could add an extra layer of awareness about the consequences of doing so and decrease the already low chance that a player quits by accident.
Competitive servers can currently:
Marking as likely decline until @Zorono can convince us. Collaborator: feel free to close if you're not convinced / if OP never responds.
@AlexTMjugador
On the other hand, about the actual functionality of asking players for confirmation to leave a server, I think that it could work like this:
A script calls a client-side function like requestDisconnectConfirmation(string reason), which asks MTA to show a confirmation message with the specified reason when the player tries to disconnect by graceful means (e.g. the main menu, Alt + F4 or the quit command). I think it would be nice that this function could be called several times, adding the different reasons to a case-insensitive set, so that MTA shows the confirmation whenever there is at least one reason in that set. A companion dismissDisconnectConfirmation([string reason]) function should be provided, that either empties the set of reasons to ask confirmation (if the reason is not provided) or removes the specified reason from the set. To prevent abuse of the requestDisconnectConfirmation function, I'd empty the set when the confirmation dialog is shown, before firing a onClientDisconnectAttempt event (so that a script can insist a bit on asking confirmation if it is doing something really worth it), and add a checkbox to suppress the message when it is shown more than once for a same server in the same session (like web browsers do when a web page abuses alert()).
this would be a good idea...
However, if well used, this feature could be valuable in competitive scenarios. For example, many gamemodes already penalize players for logging out when they are in the middle of a combat, so a function like this could add an extra layer of awareness about the consequences of doing so and decrease the already low chance that a player quits by accident.
Finally someone found this idea useful!!
@Lpsd
In my opinion, if we were ever to implement a quit confirmation dialog, we'd want the client to have control of whether this appears or not (in the MTA general settings for example). It shouldn't be controlled by the server, in any way.
this is a good idea too...
If a game asks me if I'm sure I want to quit, it's just annoying. Yes, I want to quit - I've managed to press possibly several keys then put my cursor over the Quit button and click on it. That doesn't happen by mistake.
xD it's just like "Facebook" when it shows a confirmation dialog before logging out or deactivating your account.... (i didn't see it annoying, sorry... it seems to be useful for me)
How many times have I accidentally disconnected from a server in 15+ years of playing MTA? None.
that depends on you and your stresses...
The only way I can genuinely see that you accidentally disconnect, is if your last console command was quit (when you think it's something else) then you open the console and press Arrow Up (to bring up the last entered command) and quickly hit enter. That's just unlucky. I don't think it justifies this feature.
dude, imagine that you're stressed and doing everything without attention(and.. moving your hands fast like a robot LOL)
hmm... here I am talking about my real-life situations pffs
As for @AlexTMjugador's solution, I'm not sure why the server would need multiple reasons for the quit confirmation, or even have a custom message in the first place. There's possible room for abuse by having a custom message.
i agree with you here. but @AlexTMjugador 's explanation in #issuecomment-724327745 seems good as it adds some space for creativity..
@qaisjp
@Zorono please can you explain the exact problem you are trying to solve.
dude, i felt off explaining it many times... ^^^ please have some mercy for my head
I'm not sure if "typing really fast and moving your hands like a robot" is a credible reason.
Servers could easily implement their own custom menu (as you're allowed to cancel the onClientKey event once for the escape key, after which the original menu is shown).
This would allow servers to have their own quit confirmation (upon pressing "Quit" in their custom menu). At the same time this also makes it incredibly hard for you to accidentally press the quit button on the original MTA menu.
I'm closing this issue, as I'm not convinced by the reasoning for introducing this feature. Thanks for your request though!
Most helpful comment
In my opinion, if we were ever to implement a quit confirmation dialog, we'd want the client to have control of whether this appears or not (in the MTA general settings for example). It shouldn't be controlled by the server, in any way.
If a game asks me if I'm sure I want to quit, it's just annoying. Yes, I want to quit - I've managed to press possibly several keys then put my cursor over the Quit button and click on it. That doesn't happen by mistake.
How many times have I accidentally disconnected from a server in 15+ years of playing MTA? None.
The only way I can genuinely see that you accidentally disconnect, is if your last console command was
quit(when you think it's something else) then you open the console and press Arrow Up (to bring up the last entered command) and quickly hit enter. That's just unlucky. I don't think it justifies this feature.As for @AlexTMjugador's solution, I'm not sure why the server would need multiple reasons for the quit confirmation, or even have a custom message in the first place. There's possible room for abuse by having a custom message.