Hi any idea why do we do this?
#10

Quote:
Originally Posted by 2KY
View Post
Okay, say you have 10 textdraws. For some reason, your server crashes, shuts down, restarts, whatever - and for some reason, only 4 textdraws get destroyed. When your mode starts up again, it's going to create all 10, this leads to either a) misplaced textdraw ID's or b) multiple textdraws for one ID. Either of these options aren't good, and should be prevented, which destroying them on exit does. As stated above, in programming a common practice is to run clean up code after an operation is finished.
Afaik theres no way to restart the gamemode in the same server process after a fatal crash. If the gamemode doesnt shut down properly (deleting all the textdraws) it also wont start up again, unless the server is restarted.

I guess its some placebo code, or a code artefact. There shouldnt be a scenario in which you need to "clean up" the textdraws manually on gamemode exit.
Different story for filterscripts though. Properly deleting textdraws in filterscripts is important, especially for filterscripts that are supposed to be stopped/restarted frequently, else it will create the same textdraws again and again.
So deleting textdraws in gamemodes probably comes from that. People just copied over some filterscript textdraws, and also added the cleanup part without further thinking about why they are doing it. Others might then have learned from those gamemodes, and took over that "scripting technique" for textdraws in gamemodes. Not because they need to do it, but because many other people did so before.
Reply


Messages In This Thread
Hi any idea why do we do this? - by Ritzy2K - 16.06.2015, 17:54
Re: Hi any idea why do we do this? - by theYiin - 16.06.2015, 19:40
Re: Hi any idea why do we do this? - by Ritzy2K - 17.06.2015, 04:33
Re: Hi any idea why do we do this? - by Ritzy2K - 27.06.2015, 13:57
Re: Hi any idea why do we do this? - by Youssef221 - 27.06.2015, 14:15
Re: Hi any idea why do we do this? - by Ritzy2K - 27.06.2015, 19:27
Re: Hi any idea why do we do this? - by Jonny5 - 28.06.2015, 14:50
Re: Hi any idea why do we do this? - by Ritzy2K - 28.06.2015, 18:03
Re: Hi any idea why do we do this? - by 2KY - 28.06.2015, 22:43
Re: Hi any idea why do we do this? - by Mauzen - 29.06.2015, 00:35

Forum Jump:


Users browsing this thread: 1 Guest(s)