+REP How to get the string of a textdraw?
#1

well?
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=2867
Reply
#3

There is no TextDrawGetString function or anything like that.
However, it can be easily done by creating a global string variable for your textdraw, then changing it's content as well and using TextDrawSetString at the same time, you would always naturally have the string of the textdraw..
Reply
#4

1) use YSF - it adds a lot of "missing" natives - including TextDrawGetString()
2) hook TextDrawSetString and store text in a variable, eg:

Code:
#define MAX_TEXTDRAW_STRING_LEN 128

static g_TextDrawText[MAX_TEXT_DRAWS][MAX_TEXTDRAW_STRING_LEN];

stock TextDrawGetString(Text:textid, string[], size = sizeof(string))
{
	string[0] = '\0';
	strcat(string, g_TextDrawText[_:textid], size);
	return 1;
}

stock TDGS_TextDrawSetString(Text:textid, string[])
{
	g_TextDrawText[_:textid][0] = '\0';
	strcat(g_TextDrawText[_:textid], string, MAX_TEXTDRAW_STRING_LEN);
	return TextDrawSetString(textid, string);
}

#if defined _ALS_TextDrawSetString
    #undef TextDrawSetString
#else
    #define _ALS_TextDrawSetString
#endif
#define TextDrawSetString TDGS_TextDrawSetString
Reply
#5

@Spmn: You'd also have to hook TextdrawCreate because TextDrawSetString may not be used.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)