How to do a fading textdraw?
#1

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.
Reply
#2

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.
Reply
#3

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,0x000000FF);
if(cout == 2) return TextDrawColor(Example,0x000000BB;
if(cout == 3) return TextDrawColor(Example,0x00000077);
if(cout == 4) return TextDrawColor(Example,0x00000033);
if(cout == 5) return TextDrawColor(Example,0x00000000);
if(cout == 5) return kill your timer ;

that will make your text disapear slowly
Reply
#4

That's basically it, but better since you can use TextDrawColor instead of creating a new textdraw.
Reply
#5

@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.
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)