Auto-Color changing 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: Auto-Color changing TextDraw (
/showthread.php?tid=364368)
Auto-Color changing TextDraw -
x96664 - 30.07.2012
Hi, I want to create a textdraw which is chaning it's color by itself on 60 seconds.
Can somebody help me to do it ? (an example:1st "Text" will be white and "Draw" blue and after a minute to change "Text" in yellow and "Draw" in red")
Here is what I created:
pawn Код:
new Text:Text1;
public OnGameModeInit()
{
Text1=TextDrawCreate(25.000000, 420.000000, "Text Draw");
TextDrawColor(Text1,0xFFFFFFFF);
TextDrawSetShadow(Text1,0);
TextDrawSetOutline(Text1,1);
TextDrawLetterSize(Text1,0.5,1.5);
TextDrawBackgroundColor(Text1,0x00000040);
TextDrawFont(Text1,1);
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
TextDrawShowForPlayer(playerid, Info);
return 1;
}
Re: Auto-Color changing TextDraw -
Misiur - 30.07.2012
pawn Код:
//Somewhere high
forward ChangeColor();
//Before closing braket of OnGameModeInit
SetTimer("ChangeColor", 60000, true);
//Under OnGameModeInit
public ChangeColor() {
static tick = 0;
tick++;
static colors[4][4] = { "~W~", "~Y~", "~B~", "~R~"};
static first[5] = "Text", second[5] = "Draw";
new str[32];
format(str, sizeof(str), "%s%s %s%s", colors[tick%2], first, colors[(tick%2)+2], second);
TextDrawSetString(Text1, str);
return 1;
}
It isn't very flexible, but works for your example
Re: Auto-Color changing TextDraw -
x96664 - 30.07.2012
Quote:
Originally Posted by Misiur
pawn Код:
//Somewhere high forward ChangeColor();
//Before closing braket of OnGameModeInit SetTimer("ChangeColor", 60000, true);
//Under OnGameModeInit public ChangeColor() { static tick = 0; tick++; static colors[4][4] = { "~W~", "~Y~", "~B~", "~R~"}; static first[5] = "Text", second[5] = "Draw"; new str[32]; format(str, sizeof(str), "%s%s %s%s", colors[tick%2], first, colors[(tick%2)+2], second); TextDrawSetString(Text1, str); return 1; }
It isn't very flexible, but works for your example
|
Not tested yet, but thank you! First I thought about color chaning only for one letter on every 2 seconds maybe the textdraw to be white and it starts from the frist letter to color it in blue maybe to the last one and again but I don't think that somebody would do that
.