10.07.2012, 20:25
This is extremely easy to fix.
Init your textdraw arrays/variables like so:
Hook the TextDrawDestroy function:
What's all the fuss about?
As you can see the Text:text parameter is changed to a reference (&Text:text) so we can set the variable to INVALID_TEXT_DRAW once it's deleted.
Init your textdraw arrays/variables like so:
pawn Code:
new Text:pTextdraw[MAX_PLAY] = {Text:INVALID_TEXT_DRAW, ...};
pawn Code:
stock safe_TextDrawDestroy(&Text:text)
{
if(text == Text:INVALID_TEXT_DRAW) return print("-> YOU TRIED TO DELETE A TEXTDRAW THAT DIDN'T EXIST!");
TextDrawDestroy(text);
text = Text:INVALID_TEXT_DRAW;
return 1;
}
#if defined _ALS_TextDrawDestroy
#undef TextDrawDestroy
#else
#define _ALS_TextDrawDestroy
#endif
#define TextDrawDestroy safe_TextDrawDestroy
As you can see the Text:text parameter is changed to a reference (&Text:text) so we can set the variable to INVALID_TEXT_DRAW once it's deleted.