SA-MP Forums Archive
+REP How to get the string of a textdraw? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: +REP How to get the string of a textdraw? (/showthread.php?tid=624756)



+REP How to get the string of a textdraw? - Lirbo - 22.12.2016

well?


Re: +REP How to get the string of a textdraw? - Bolex_ - 22.12.2016

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


Re: +REP How to get the string of a textdraw? - Battlezone - 22.12.2016

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..


Re: +REP How to get the string of a textdraw? - Spmn - 22.12.2016

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



Re: +REP How to get the string of a textdraw? - Konstantinos - 22.12.2016

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