[TextDraws] Can't be created in for loop? - 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: [TextDraws] Can't be created in for loop? (
/showthread.php?tid=534517)
[TextDraws] Can't be created in for loop? -
vakhtang - 30.08.2014
Greeting people. I have an array ( new Text:TextdrawDots[6]; ) and somehow I can't create textdraws in loop. Here is the for loop INSIDE OnFilterScriptInit():
pawn Код:
new Float:mult = 34.0;
for (new i = 0; i < 6; i++) {
createArrowTextDraw(TextdrawDots[i], getPosX(mult, 0.0), getPosY(mult, 0.0));
// getPosX and getPosY both functions return float
mult -= 6.0;
}
And the createArrowFunction:
pawn Код:
createArrowTextDraw(Text:tmpTextDraw, Float:x, Float:y) {
tmpTextDraw = TextDrawCreate(x, y, CHAR); // CHAR is defined and is "."
TextDrawBackgroundColor(tmpTextDraw, 255);
TextDrawFont(tmpTextDraw, 1);
TextDrawLetterSize(tmpTextDraw, 0.569999, 2.000000);
TextDrawColor(tmpTextDraw, -1);
TextDrawSetOutline(tmpTextDraw, 1);
TextDrawSetProportional(tmpTextDraw, 1);
}
Re: [TextDraws] Can't be created in for loop? -
vakhtang - 30.08.2014
Sorry guys

The problem was ampersand

in function it has to get reference for textdraw:
pawn Код:
createArrowTextDraw(&Text:tmpTextDraw, Float:x, Float:y) {
tmpTextDraw = TextDrawCreate(x, y, CHAR);
TextDrawBackgroundColor(tmpTextDraw, 255);
TextDrawFont(tmpTextDraw, 1);
TextDrawLetterSize(tmpTextDraw, 0.569999, 2.000000);
TextDrawColor(tmpTextDraw, -1);
TextDrawSetOutline(tmpTextDraw, 1);
TextDrawSetProportional(tmpTextDraw, 1);
}