30.06.2011, 19:55
Its something like that
to add now a second parameter shouldnt be hard
Example:
recall time = 250ms (increased recall for a smoother vanish)
vanish time = 5s
ticks = vanish time / recall time
alpha decrease = 255 / ticks = 255 * recall time / vanish time = 255 * 250ms / 5s = 12.75
pawn Код:
forward TextDrawVanish(Text: text, color); //needs an color parameter
public TextDrawVanish(Text: text, color) { //since there is no function to get it
new
alpha = color & 0xFF; //gets the alpha part of the color
if(alpha) { //checks if the alpha is not 0
if(alpha < 0x11) {
color -= alpha;
} else { //decrease the alpha ratio
color -= 0x11;
}
TextDrawColor(text, color); //sets the new color
SetTimerEx("TextDrawVanish", 1000, false, "ii", _: text, color); //recalls the function
}
}
Example:
recall time = 250ms (increased recall for a smoother vanish)
vanish time = 5s
ticks = vanish time / recall time
alpha decrease = 255 / ticks = 255 * recall time / vanish time = 255 * 250ms / 5s = 12.75