The problem with MAX_ALPHA and MIN_ALPHA
#1

Hi, I have a problem with taking textdraw, who with the help of SetTimerEx with time went to the MAX_ALPHA or rgb - 255, and after the expiration of such 5 sec disappeared into Min_Alpha - rgb - 0
It can be done somehow?
It gives a link to the example: [ame]http://www.youtube.com/watch?v=h8DvkKL8sdk[/ame]
Please help
Reply
#2

Its something like that

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

em, not good it does not work
Reply
#4

Hmm, I do not know you help? ...
I really do not know where to put: (
Код:
forward AnnForPrexentItd(time, string[]);
public AnnForPrexentItd(time, string[])
{
	for(new x; x < GetMaxPlayers; x++)
	{
		TextDrawShowForAll(AnnAtrakcji);
		TextDrawSetString(AnnAtrakcji, string);
		KillTimer(AnnLiczdoWyl);
		AnnLiczdoWyl = SetTimerEx("AnnWylaczTD", time, 0, "i", x);
	}
	TextDrawVanish(AnnAtrakcji, 0xECFCC7FF);
	return 1;
}
forward AnnWylaczTD();
public AnnWylaczTD()
{
	TextDrawHideForAll(AnnAtrakcji);
	TextDrawSetString(AnnAtrakcji,"_");
	return 1;
}
Reply
#5

Em, help me?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)