11.01.2018, 16:42
So, over the past few days, I've been trying to learn more about best practices concerning textdraws, per-player textdraws in particular. I've stumbled upon a few threads that discussed this exact issue which you can find here:
Do I need to use an array with PlayerTextDraws?
Some say it's needed because the order in which the textdraws are created matters, and IDs could get mixed up when you're not using an array. This, however, assumes that player textdraws are created when they're needed as opposed to creating them in bulk when a player connects and only showing and hiding them. At least that's how I understand it.
Others say it's not needed because there would be no point in having a 'playerid' parameter then. This assumes that you create all textdraws in bulk when a player connects and never destroy them. We're talking about a variable size reduction by the factor of MAX_PLAYERS, which is huge. This leads me to my next question...
When do I create/destroy textdraws?
Do I want to create them all at once and only show and hide them, or do I want to create them when they are needed and destroy them immediately when they are not needed anymore?
- https://sampforum.blast.hk/showthread.php?tid=568734
- https://sampforum.blast.hk/showthread.php?tid=354966)
Do I need to use an array with PlayerTextDraws?
Some say it's needed because the order in which the textdraws are created matters, and IDs could get mixed up when you're not using an array. This, however, assumes that player textdraws are created when they're needed as opposed to creating them in bulk when a player connects and only showing and hiding them. At least that's how I understand it.
Others say it's not needed because there would be no point in having a 'playerid' parameter then. This assumes that you create all textdraws in bulk when a player connects and never destroy them. We're talking about a variable size reduction by the factor of MAX_PLAYERS, which is huge. This leads me to my next question...
When do I create/destroy textdraws?
Do I want to create them all at once and only show and hide them, or do I want to create them when they are needed and destroy them immediately when they are not needed anymore?