any idea how to make fade in red effects?
#1

I'm wondering if someone has this script. because i needing it for my Solar Flare to make it reality.
i'm not sure but i try the Include there but the Plugin is missing. so i'm confuse i go here so i can
get some good tips to make a fade in red effects.

by ScriptJorkis
Reply
#2

use Textdraw
Reply
#3

i don't know how to do it since i do not use Textdraw so much i use it once a time
Reply
#4

please anyone?, since 1 day has been past.
Reply
#5

Use this if you are lazy to make fades by yourself using TextDraw.
Reply
#6

i'm not really lazy at all i just want to know how to do it. it gives me error even i add the define include on the include nothing else but didn't work
Reply
#7

Quote:
Originally Posted by ScriptJorkis
Посмотреть сообщение
i'm not really lazy at all i just want to know how to do it. it gives me error even i add the define include on the include nothing else but didn't work
It should work fine if you are using it correctly.
Reply
#8

i did it right heres the code

pawn Код:
///////////////////////////////////////
///////////Made by Joe Staff///////////
///////////////////////////////////////

#if defined _Fade_included
    #endinput
#endif 
#define _Fade_included

#include <a_samp>
#define _UPDATERATE 100 //milliseconds
forward _UpdateFadeTimer();
forward OnFadeComplete(playerid,beforehold);
new _pEndColor[MAX_PLAYERS][4];
new _pCurrentColor[MAX_PLAYERS][4];
new _pRateColor[MAX_PLAYERS][4];
new _pStep[MAX_PLAYERS];
new _pHold[MAX_PLAYERS];
new _OPArray[MAX_PLAYERS];
new _OnlinePlayers;
new Text:_text; //Look, only one!

/*
native ConvertToColor(RR,GG,BB,AA);
native StopPlayerFade(playerid);
native FadeColorForPlayer(playerid,RR1,GG1,BB1,AA1,RR2,GG2,BB2,AA2,steps,hold);
native FadeInit();
native FadeExit();
native FadePlayerConnect(playerid);
native FadePlayerDisonnect(playerid);
*/




stock ConvertToColor(RR,GG,BB,AA)return (RR*16777216)+(GG*65536)+(BB*256)+AA;
stock _UpdateOPA(playerid=INVALID_PLAYER_ID) //my version of foreach (I made it before ****** did! publicly anyway)
{
    _OnlinePlayers=0;
    for(new ply;ply<MAX_PLAYERS;ply++)
    {
        if(IsPlayerConnected(ply)&&(ply!=playerid))
        {
            _OPArray[_OnlinePlayers]=ply;
            _OnlinePlayers++;
        }
    }
}
stock FadeColorForPlayer(playerid,RR1,GG1,BB1,AA1,RR2,GG2,BB2,AA2,steps,hold)
{
    _pStep[playerid]=steps;//countdown, sorta
    new tmpsteps; //This will have to be added to incase the math is messed up (programming annoyance)
    _pHold[playerid]=hold;//How long the last color is held before disappearing (Divide this by UPDATERATE to get the time Ex:hold=10, in milliseconds that's 1000)
    _pEndColor[playerid][0]=RR2;
    _pEndColor[playerid][1]=GG2;
    _pEndColor[playerid][2]=BB2;
    _pEndColor[playerid][3]=AA2;
    _pCurrentColor[playerid][0]=RR1;
    _pCurrentColor[playerid][1]=GG1;
    _pCurrentColor[playerid][2]=BB1;
    _pCurrentColor[playerid][3]=AA1;
    _pRateColor[playerid][0]=(RR1-RR2)/steps;
    _pRateColor[playerid][1]=(GG1-GG2)/steps;
    _pRateColor[playerid][2]=(BB1-BB2)/steps;
    _pRateColor[playerid][3]=(AA1-AA2)/steps;
    //No dividing by 0!
    if(_pRateColor[playerid][0]!=0)if(((RR1-RR2)/_pRateColor[playerid][0])>steps)tmpsteps=((RR1-RR2)/_pRateColor[playerid][0])-steps;
    if(_pRateColor[playerid][1]!=0)if(((GG1-GG2)/_pRateColor[playerid][1])>steps+tmpsteps)tmpsteps=((GG1-GG2)/_pRateColor[playerid][1])-steps;
    if(_pRateColor[playerid][2]!=0)if(((BB1-BB2)/_pRateColor[playerid][2])>steps+tmpsteps)tmpsteps=((BB1-BB2)/_pRateColor[playerid][2])-steps;
    if(_pRateColor[playerid][3]!=0)if(((AA1-AA2)/_pRateColor[playerid][3])>steps+tmpsteps)tmpsteps=((AA1-AA2)/_pRateColor[playerid][3])-steps;
    if(tmpsteps)_pStep[playerid]+=tmpsteps;
}
FadeInit()
{
    _text=TextDrawCreate(0.0,0.0,"~r~");
    TextDrawTextSize(_text,640,480);
    TextDrawLetterSize(_text,0.0,50.0);
    TextDrawUseBox(_text,1);
    SetTimer("_UpdateFadeTimer",_UPDATERATE,1);
    _UpdateOPA();
    return 1;
}
FadeExit()
{
    TextDrawDestroy(_text);
    return 1;
}
FadePlayerConnect(playerid)
{
    _UpdateOPA();
    _pHold[playerid]=-1;
    _pStep[playerid]=-1;
    return 1;
}
FadePlayerDisconnect(playerid)
{
    _UpdateOPA(playerid);
    return 1;
}
stock StopPlayerFade(playerid)
{
    _pStep[playerid]=0;
    _pHold[playerid]=0;
}
public _UpdateFadeTimer()
{
    new playerid;
    for(new opa;opa<_OnlinePlayers;opa++)
    {
        playerid=_OPArray[opa];
        if(_pStep[playerid])
        {
            _pStep[playerid]--;
            for(new color;color<4;color++)
            {
                _pCurrentColor[playerid][color]-=_pRateColor[playerid][color];
                if(_pRateColor[playerid][color]>0)
                {
                    if(_pCurrentColor[playerid][color]<_pEndColor[playerid][color])_pCurrentColor[playerid][color]=_pEndColor[playerid][color];
                }
                if(_pRateColor[playerid][color]<0)
                {
                    if(_pCurrentColor[playerid][color]>_pEndColor[playerid][color])_pCurrentColor[playerid][color]=_pEndColor[playerid][color];
                }
                if(_pCurrentColor[playerid][color]<0)_pCurrentColor[playerid][color]=0;
                if(_pCurrentColor[playerid][color]>255)_pCurrentColor[playerid][color]=255;
            }
            TextDrawBoxColor(_text,ConvertToColor(_pCurrentColor[playerid][0],_pCurrentColor[playerid][1],_pCurrentColor[playerid][2],_pCurrentColor[playerid][3]));
            TextDrawShowForPlayer(playerid,_text);
        }
        else if(_pStep[playerid]==0)
        {
            _pStep[playerid]=-1;
            CallLocalFunction("OnFadeComplete","ii",playerid,1);
        }
        else if(_pHold[playerid])
        {
            _pHold[playerid]--;
        }
        else if(_pHold[playerid]==0)
        {
            _pHold[playerid]=-1;
            TextDrawHideForPlayer(playerid,_text);
            CallLocalFunction("OnFadeComplete","ii",playerid,0);
        }
    }
}
Reply
#9

Quote:
Originally Posted by ScriptJorkis
Посмотреть сообщение
i did it right heres the code

pawn Код:
///////////////////////////////////////
///////////Made by Joe Staff///////////
///////////////////////////////////////

#if defined _Fade_included
    #endinput
#endif 
#define _Fade_included

#include <a_samp>
#define _UPDATERATE 100 //milliseconds
forward _UpdateFadeTimer();
forward OnFadeComplete(playerid,beforehold);
new _pEndColor[MAX_PLAYERS][4];
new _pCurrentColor[MAX_PLAYERS][4];
new _pRateColor[MAX_PLAYERS][4];
new _pStep[MAX_PLAYERS];
new _pHold[MAX_PLAYERS];
new _OPArray[MAX_PLAYERS];
new _OnlinePlayers;
new Text:_text; //Look, only one!

/*
native ConvertToColor(RR,GG,BB,AA);
native StopPlayerFade(playerid);
native FadeColorForPlayer(playerid,RR1,GG1,BB1,AA1,RR2,GG2,BB2,AA2,steps,hold);
native FadeInit();
native FadeExit();
native FadePlayerConnect(playerid);
native FadePlayerDisonnect(playerid);
*/




stock ConvertToColor(RR,GG,BB,AA)return (RR*16777216)+(GG*65536)+(BB*256)+AA;
stock _UpdateOPA(playerid=INVALID_PLAYER_ID) //my version of foreach (I made it before ****** did! publicly anyway)
{
    _OnlinePlayers=0;
    for(new ply;ply<MAX_PLAYERS;ply++)
    {
        if(IsPlayerConnected(ply)&&(ply!=playerid))
        {
            _OPArray[_OnlinePlayers]=ply;
            _OnlinePlayers++;
        }
    }
}
stock FadeColorForPlayer(playerid,RR1,GG1,BB1,AA1,RR2,GG2,BB2,AA2,steps,hold)
{
    _pStep[playerid]=steps;//countdown, sorta
    new tmpsteps; //This will have to be added to incase the math is messed up (programming annoyance)
    _pHold[playerid]=hold;//How long the last color is held before disappearing (Divide this by UPDATERATE to get the time Ex:hold=10, in milliseconds that's 1000)
    _pEndColor[playerid][0]=RR2;
    _pEndColor[playerid][1]=GG2;
    _pEndColor[playerid][2]=BB2;
    _pEndColor[playerid][3]=AA2;
    _pCurrentColor[playerid][0]=RR1;
    _pCurrentColor[playerid][1]=GG1;
    _pCurrentColor[playerid][2]=BB1;
    _pCurrentColor[playerid][3]=AA1;
    _pRateColor[playerid][0]=(RR1-RR2)/steps;
    _pRateColor[playerid][1]=(GG1-GG2)/steps;
    _pRateColor[playerid][2]=(BB1-BB2)/steps;
    _pRateColor[playerid][3]=(AA1-AA2)/steps;
    //No dividing by 0!
    if(_pRateColor[playerid][0]!=0)if(((RR1-RR2)/_pRateColor[playerid][0])>steps)tmpsteps=((RR1-RR2)/_pRateColor[playerid][0])-steps;
    if(_pRateColor[playerid][1]!=0)if(((GG1-GG2)/_pRateColor[playerid][1])>steps+tmpsteps)tmpsteps=((GG1-GG2)/_pRateColor[playerid][1])-steps;
    if(_pRateColor[playerid][2]!=0)if(((BB1-BB2)/_pRateColor[playerid][2])>steps+tmpsteps)tmpsteps=((BB1-BB2)/_pRateColor[playerid][2])-steps;
    if(_pRateColor[playerid][3]!=0)if(((AA1-AA2)/_pRateColor[playerid][3])>steps+tmpsteps)tmpsteps=((AA1-AA2)/_pRateColor[playerid][3])-steps;
    if(tmpsteps)_pStep[playerid]+=tmpsteps;
}
FadeInit()
{
    _text=TextDrawCreate(0.0,0.0,"~r~");
    TextDrawTextSize(_text,640,480);
    TextDrawLetterSize(_text,0.0,50.0);
    TextDrawUseBox(_text,1);
    SetTimer("_UpdateFadeTimer",_UPDATERATE,1);
    _UpdateOPA();
    return 1;
}
FadeExit()
{
    TextDrawDestroy(_text);
    return 1;
}
FadePlayerConnect(playerid)
{
    _UpdateOPA();
    _pHold[playerid]=-1;
    _pStep[playerid]=-1;
    return 1;
}
FadePlayerDisconnect(playerid)
{
    _UpdateOPA(playerid);
    return 1;
}
stock StopPlayerFade(playerid)
{
    _pStep[playerid]=0;
    _pHold[playerid]=0;
}
public _UpdateFadeTimer()
{
    new playerid;
    for(new opa;opa<_OnlinePlayers;opa++)
    {
        playerid=_OPArray[opa];
        if(_pStep[playerid])
        {
            _pStep[playerid]--;
            for(new color;color<4;color++)
            {
                _pCurrentColor[playerid][color]-=_pRateColor[playerid][color];
                if(_pRateColor[playerid][color]>0)
                {
                    if(_pCurrentColor[playerid][color]<_pEndColor[playerid][color])_pCurrentColor[playerid][color]=_pEndColor[playerid][color];
                }
                if(_pRateColor[playerid][color]<0)
                {
                    if(_pCurrentColor[playerid][color]>_pEndColor[playerid][color])_pCurrentColor[playerid][color]=_pEndColor[playerid][color];
                }
                if(_pCurrentColor[playerid][color]<0)_pCurrentColor[playerid][color]=0;
                if(_pCurrentColor[playerid][color]>255)_pCurrentColor[playerid][color]=255;
            }
            TextDrawBoxColor(_text,ConvertToColor(_pCurrentColor[playerid][0],_pCurrentColor[playerid][1],_pCurrentColor[playerid][2],_pCurrentColor[playerid][3]));
            TextDrawShowForPlayer(playerid,_text);
        }
        else if(_pStep[playerid]==0)
        {
            _pStep[playerid]=-1;
            CallLocalFunction("OnFadeComplete","ii",playerid,1);
        }
        else if(_pHold[playerid])
        {
            _pHold[playerid]--;
        }
        else if(_pHold[playerid]==0)
        {
            _pHold[playerid]=-1;
            TextDrawHideForPlayer(playerid,_text);
            CallLocalFunction("OnFadeComplete","ii",playerid,0);
        }
    }
}
Are you trying the compile the inc? What should I do with the inc? It's working fine for me.
Reply
#10

it work it just give me error in my other server folder. thanks anyway...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)