How to do a fading textdraw? -
PCheriyan007 - 10.06.2011
I want to learn how to do a fading textdraw. I don't want anything like includes or Filterscripts, I want to know the code. What I want to do is make the screen white then fade out to nothing (back to game). If anybody could teach me how to do this I would greatly appreciate it.
Re: How to do a fading textdraw? -
Tee - 10.06.2011
Well, this is not the best but, maybe create about 15 textdraws that gets lighter by using a timer.
Example:
Textdraw0 would be full white.
Textdraw1 would be lighter than Textdraw0.
Textdraw2 would be lighter than Textdrea1.
etc.
So every second or so, create a textdraw that is lighter than the one before.
There is an injured system somewhere one the forums that when you get hurt, the screen goes red and I think it fades.
Re : How to do a fading textdraw? -
Amine_Mejrhirrou - 10.06.2011
you can use a timer + a counter
use a timer with 1000 ms (infinite loop)
use a couter (count) for example
set count+ 1 in the timer and set a
if(cout == 1) return TextDrawColor(Example,0x000000
FF);
if(cout == 2) return TextDrawColor(Example,0x000000
BB;
if(cout == 3) return TextDrawColor(Example,0x000000
77);
if(cout == 4) return TextDrawColor(Example,0x000000
33);
if(cout == 5) return TextDrawColor(Example,0x000000
00);
if(cout == 5) return kill your timer ;
that will make your text disapear slowly
Re: How to do a fading textdraw? -
Tee - 10.06.2011
That's basically it, but better since you can use TextDrawColor instead of creating a new textdraw.
Re: How to do a fading textdraw? -
PCheriyan007 - 10.06.2011
@Tee - I found that system but I want to see whether writing out the code is more effective than using the include. Since I write some scripts for another server, I tend to want to keep it as compatible with the server as possible. Also the owner does use that "Red and Fade" system so I'll ask him whether he uses that include or not.
@Amine - could you write out the code for that or put it in [pawn] tags.
Re: How to do a fading textdraw? -
Sascha - 10.06.2011
pawn Code:
new time[MAX_PLAYERS];
new count = 0;
public WHEREEVERYOUWANTTOUSEIT
{
time[playerid] = SetTimerEx("FadeOut", 1000, true, "i", playerid);
return 1;
}
forward FadeOut(playerid);
public FadeOut(playerid)
{
count++;
if(count== 1) return TextDrawColor(Example,0x000000FF);
if(count== 2) return TextDrawColor(Example,0x000000BB;
if(count== 3) return TextDrawColor(Example,0x00000077);
if(count== 4) return TextDrawColor(Example,0x00000033);
if(count== 5) return TextDrawColor(Example,0x00000000);
if(count== 5) KillTimer(time[playerid]) ;
return 1;
}
something like that..