SA-MP Forums Archive
The problem with MAX_ALPHA and MIN_ALPHA - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: The problem with MAX_ALPHA and MIN_ALPHA (/showthread.php?tid=265397)



The problem with MAX_ALPHA and MIN_ALPHA - aniol16 - 30.06.2011

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


AW: The problem with MAX_ALPHA and MIN_ALPHA - Nero_3D - 30.06.2011

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


Re: The problem with MAX_ALPHA and MIN_ALPHA - aniol16 - 04.07.2011

em, not good it does not work


Re: The problem with MAX_ALPHA and MIN_ALPHA - aniol16 - 15.07.2011

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;
}



Re: The problem with MAX_ALPHA and MIN_ALPHA - aniol16 - 15.07.2011

Em, help me?