Filter String for Textdraws - 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: Filter String for Textdraws (
/showthread.php?tid=408493)
Filter String for Textdraws -
Roel - 18.01.2013
Hello, I made a function to filter out characters like [ ] * to avoid stars or other wierd things inside a textdraw string.
pawn Код:
stock CompareStringForTextdraw(text[])
{
new strpos;
new invalidstr[3][2] = {
"[","]","*"};
for (new s=0; s<strlen(text); s++)
{
for (new x=0; x<sizeof(invalidstr); x++)
{
strpos = strfind(text, invalidstr[x], true);
if(strpos != -1)
{
strdel(text, strpos, strpos+1);
}
}
}
return text;
}
Now this what I got, but it doesn't work I get only wierd characters out of it.
Maybe somebody sees the fault? because i don't lol.
Re: Filter String for Textdraws -
LarzI - 18.01.2013
Try this:
pawn Код:
stock CompareStringForTextdraw(text[])
{
new
strpos,
invalidstr[3][2] = { "[", "]", "*" }
;
for (new x=0; x<sizeof(invalidstr); x++)
{
strpos = strfind(text, invalidstr[x], true);
if(strpos != -1)
{
strdel(text, strpos, strpos+1);
}
}
return text;
}