openmultiplayer / open.mp

Open Multiplayer, a multiplayer mod fully backwards compatible with SA-MP
https://open.mp
Mozilla Public License 2.0
470 stars 99 forks source link

Dialog reappears continuously when it is shown using pickups #971

Closed midosvt closed 3 weeks ago

midosvt commented 2 months ago

Hello, I’m not sure if this has ever been noticed or reported before, but I’ll bring it up anyway. I encountered a bug while working on a skin change system using pickups. If you show a dialog to a player when they pick up a pickup, the dialog will keep reappearing continuously without stopping, even if you cancel it. If you remain at that pickup position, it will keep showing.

I’ve tested this on the latest versions of open.mp and SA-MP, and the issue occurs on both. It also affects streamer pickups. I tried other things like checkpoints, and they worked fine, so it seems to be an issue specifically with pickups.

Here are two versions of a simple test script I created if anyone wants to test or reproduce the issue:

If anyone has additional information about this, please feel free to share it below.

Vince0789 commented 2 months ago

Known issue with pickups. Remaining stationary in a pickup will trigger OnPlayerPickUpPickup every few seconds. May be a client issue, or just how the game works since most pickups in the single player game are designed to disappear once picked up.

In any case, it is unrelated to dialogs or whatever code may be in that callback.

Workaround is to set a variable so the same code isn't triggered multiple times.

midosvt commented 2 months ago

Ah, I see. I just tested it with a client message, and it exhibits the same behavior. I guess I never noticed it before because I mainly use pickups for teleportation, but I thought of doing something different this time. I'll leave this open in case anyone else has additional insights or if someone wants to add more information.

prox-us commented 2 months ago

As mentioned above, it's a common pickup issue. In fact, I am fairly sure it doesn't apply to all pickup types but the most commonly used type(s) are affected, and the other ones have their own drawbacks.

The way I handled it was having a circle area and a variable for the last pickup, so that when they exit the little circle (can be adjusted for UX - how far they should need to move about to be able to pick it up again etc), it resets the variable and it can be picked up again. And then obviously, the pickup ID is compared in the pickup callback to make sure it's different otherwise ignore it. Might be a better way, but for me, this works very well.

equinnoxy commented 3 weeks ago

For me, to avoid this issue, i just make a toggle to do action with those pickups (example: enter/exit building). Been experienced this long time ago (in SA:MP Server) especially when I get high packetlosses.