05.09.2018, 17:15
Looks good, but you made one logical mistake.
If I create moneybars for 500 players, this will use 500 global textdraws since it creates the box everytime I use CreateMoneyBar. The worst part is that the first 499 will have no reference and cannot be deleted anymore.
Put the code for creating the box into OnGameModeInit/OnFilterScriptInit and destroy it in OnGameModeExit/OnFilterScriptExit.
Talking of that this won't properly work in filterscripts since you only hooked OnGameModeInit/Exit.
Also the Money Bars should be deleted when the filterscript is unloaded. Use the define "FILTERSCRIPT" to know if the script it is included in is a filterscript or gamemode.
So far you specifically disallow filterscripts (endinput if filterscript) but that doesn't make sense to me. Why not allow it for both?
If I create moneybars for 500 players, this will use 500 global textdraws since it creates the box everytime I use CreateMoneyBar. The worst part is that the first 499 will have no reference and cannot be deleted anymore.
Put the code for creating the box into OnGameModeInit/OnFilterScriptInit and destroy it in OnGameModeExit/OnFilterScriptExit.
Talking of that this won't properly work in filterscripts since you only hooked OnGameModeInit/Exit.
Also the Money Bars should be deleted when the filterscript is unloaded. Use the define "FILTERSCRIPT" to know if the script it is included in is a filterscript or gamemode.
So far you specifically disallow filterscripts (endinput if filterscript) but that doesn't make sense to me. Why not allow it for both?