[Ajuda] Textdraw Box Color
#3

Quote:
Originally Posted by RedMF
Посмотреть сообщение
muda bem aqui
Код:
#define BOX_COLOR 0xFF0000FF
agora esta vermelho
e sу colocar a cor que vocк quer

Код:
#include <a_samp>
#define BOX_COLOR 0xFF0000FF // coloca aqui a cor que vocк quer
main() {
    assert(GetGradientColor(0x00FF00FF, 0xFF0000FF, 700, 200) == 0x49B600FF);

}
GetGradientColor(From, To, Steps, Step)
{
    new
        sr,
        sg,
        sb,
        sa,
        er,
        eg,
        eb,
        ea,
        r,
        g,
        b,
        a,
        Float:n
    ;
    // Macro by AbyssMorgan
    #define ___(%0,%1,%2,%3,%4)    (((%1) = ((%0) >>> 24)),((%2) = (((%0) >>> 16) & 0xFF)),((%3) = (((%0) >>> 8) & 0xFF)),((%4) = ((%0) & 0xFF)))
    ___(From, sr, sg, sb, sa);
    ___(To,  er, eg, eb, ea);
    #undef ___
    n = float(Step) / float(Steps-1);
    r = floatround(float(sr) * (1.0-n) + float(er) * n);
    g = floatround(float(sg) * (1.0-n) + float(eg) * n);
    b = floatround(float(sb) * (1.0-n) + float(eb) * n);
    a = floatround(float(sa) * (1.0-n) + float(ea) * n);
    new color;
    #define ___(%0,%1,%2,%3,%4)    ((%0) = ((%4) & 0xFF) | (((%3) & 0xFF) << 8) | (((%2) & 0xFF) << 16) | ((%1) << 24))
    ___(color,  r, g, b, a);
    #undef ___
    return color;
}
new PlayerText:bar[MAX_PLAYERS][3];
public OnPlayerConnect(playerid)
{
/*
*    bar[playerid][0]        --    Fundo (Bordas pretas)
*    bar[playerid][1]        --    Fundo (Parte mais clara do Progresso)
*    bar[playerid][2]        --    Progresso
*/
    bar[playerid][0] = CreatePlayerTextDraw(playerid, 484.500000, 320.666717, "_");
    PlayerTextDrawLetterSize(playerid, bar[playerid][0], 0.445000, 0.608333);
    PlayerTextDrawTextSize(playerid, bar[playerid][0], 582.500000, 0.000000);
    PlayerTextDrawUseBox(playerid, bar[playerid][0], 1);
    PlayerTextDrawBoxColor(playerid, bar[playerid][0], BOX_COLOR);

    bar[playerid][1] = CreatePlayerTextDraw(playerid, 486.500000, 322.416717, "_");
    PlayerTextDrawLetterSize(playerid, bar[playerid][1], 0.440000, 0.275833);
    PlayerTextDrawTextSize(playerid, bar[playerid][1], 580.500000, 0.000000);
    PlayerTextDrawUseBox(playerid, bar[playerid][1], 1);
    PlayerTextDrawBoxColor(playerid, bar[playerid][1], BOX_COLOR);

    bar[playerid][2] = CreatePlayerTextDraw(playerid, 486.500000, 322.416717, "_");
    PlayerTextDrawLetterSize(playerid, bar[playerid][2], 0.440000, 0.275833);
    PlayerTextDrawTextSize(playerid, bar[playerid][2], 580.500000, 0.000000);
    PlayerTextDrawUseBox(playerid, bar[playerid][2], 1);
    PlayerTextDrawBoxColor(playerid, bar[playerid][2], BOX_COLOR);
    SetTimerEx("t", 500, true, "d", playerid);
    PlayerTextDrawShow(playerid, bar[playerid][0]);
    PlayerTextDrawShow(playerid, bar[playerid][1]);
    PlayerTextDrawShow(playerid, bar[playerid][2]);
    GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
    return 1;
}
forward t(playerid);
public t(playerid)
{
    new
        Float:Vida
    ;
    GetVehicleHealth(GetPlayerVehicleID(playerid), Vida);
    new
        Float:Progresso = (((Vida - 300.0) / 700.0) * 100.0),
        cor = 0xFF0000FF
    ;
    if(Progresso >= 1.0)
        cor = GetGradientColor(0x00FF00FF, 0xFF0000FF, 700, floatround(Progresso));
    else
        Progresso = 0.0;
    PlayerTextDrawHide(playerid, bar[playerid][1]);
    PlayerTextDrawHide(playerid, bar[playerid][2]);
    new string[128];
    format(string, sizeof(string), "Progresso: %d Cor: 0x%x-0x%x", floatround(Progresso), cor, (0x77 | (~0xFF & cor)));
    SendClientMessage(playerid, -1, string);
    PlayerTextDrawBoxColor(playerid, bar[playerid][1], BOX_COLOR);
    PlayerTextDrawBoxColor(playerid, bar[playerid][2], BOX_COLOR);
    PlayerTextDrawTextSize(playerid, bar[playerid][2], (486.500000 + ((94.00000 * Progresso) / 100)), 0.0);
    PlayerTextDrawShow(playerid, bar[playerid][1]);
    PlayerTextDrawShow(playerid, bar[playerid][2]);
}
public OnPlayerSpawn(playerid)
{
	TextDrawShowForPlayer(playerid, bar[playerid][0]);
    CreateVehicle(411, -5.1338,15.1673,3.1172,340.7928, 1, 1, 15);
    SetPlayerHealth(playerid, 10000.0);
    SetPlayerPos(playerid, -5.1338,7.1673,3.1172);
    SetPlayerInterior(playerid,0);
    TogglePlayerClock(playerid,0);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
       return 1;
}

SetupPlayerForClassSelection(playerid)
{
     SetPlayerInterior(playerid,14);
    SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
    SetPlayerFacingAngle(playerid, 270.0);
    SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
    SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
}

public OnPlayerRequestClass(playerid, classid)
{
    SetupPlayerForClassSelection(playerid);
    return 1;
}
public OnPlayerClickMap(playerid, Float:fX, Float:fY, Float:fZ)
{
    SetPlayerPos(playerid, fX, fY, 30.0);
    SetPlayerHealth(playerid, 1000.0);
}
public OnGameModeInit()
{
    SetGameModeText("Bare Script");
    ShowPlayerMarkers(1);
    ShowNameTags(1);
    return 1;
}
Pelo oque entendi ele, falou que a cor esta sendo Gerada porem nгo esta trocando a cor do TextDraw, esta ficando sempre VERDE, oque entendi foi isso, me desculpe caso eu esteja errado.
Reply


Messages In This Thread
Textdraw Box Color - by Dayvison_ - 30.09.2016, 16:02
Re: Textdraw Box Color - by RedMF - 30.09.2016, 21:43
Re: Textdraw Box Color - by Carlos001 - 30.09.2016, 21:56
Re: Textdraw Box Color - by Dayvison_ - 30.09.2016, 21:59
Re: Textdraw Box Color - by RodrigoMSR - 01.10.2016, 01:54
Re: Textdraw Box Color - by Dayvison_ - 01.10.2016, 21:09

Forum Jump:


Users browsing this thread: 1 Guest(s)