[DUV] Atualizar TextDrawn
#1

E ae manolozada

Й o seguinte, fiz uma textdrawn com box, bonitinha, linda e maravilhosa para meu servidor, nele vai as informaзхes de Level, Kills, Death, Exp, estudo. Porйm, eu precisava que ela atualizasse toda vez alguma informaзхes fosse alterada, ou de segundos em segundos. Como faz? :S

Code dela:

pawn Код:
new string[256];
    format(string, 256, "                ~w~Kills:~r~ %d ~w~Deaths:~r~ %d ~w~Level:~r~ %d ~w~Exp:~r~ %d ~w~Estudos:~r~ %d", pap_CarregarInt(playerid, "Matou"), pap_CarregarInt(playerid, "Morreu"), pap_CarregarInt(playerid, "Level"), pap_CarregarInt(playerid, "Experiencia"), pap_CarregarInt(playerid, "Estudos"));
    Infos = TextDrawCreate(0,421.5,string);
    TextDrawUseBox(Infos,1);
    TextDrawBoxColor(Infos,0x00000066);
    TextDrawTextSize(barra,800,400);
    TextDrawAlignment(Infos,0);
    TextDrawBoxColor(barra, 126); //Cor do fundo
    TextDrawBackgroundColor(Infos,0x000000ff);
    TextDrawFont(Infos,1);
    TextDrawColor(Infos,0xffffffff);
    TextDrawSetOutline(Infos,1);
    TextDrawSetProportional(Infos,1);
    TextDrawSetShadow(Infos,1);
Reply
#2

mete um timer pra ele destruir e depois recriar a textdraw, olha o FS de velocimetro do TiagoPS ele faz bem o q vc qr
pawn Код:
forward
    ChecarVelocimetro();
pawn Код:
SetTimer("ChecarVelocimetro", 500, 1);
pawn Код:
public ChecarVelocimetro()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i))
            {
                format(string, sizeof(string), "~g~Velocidade ~r~%dKM/h", VelocidadeKM(i));
                TextDrawSetString(Textdraw2[i],string);
                TextDrawShowForPlayer(i,Textdraw0[i]);
                TextDrawShowForPlayer(i,Textdraw1[i]);
                TextDrawShowForPlayer(i,Textdraw2[i]);
            }
            else
            {
                TextDrawHideForPlayer(i,Textdraw0[i]);
                TextDrawHideForPlayer(i,Textdraw1[i]);
                TextDrawHideForPlayer(i,Textdraw2[i]);
            }
        }
    }
    return 1;
}
ai eh soh add ou alterar os nomes dos textdraws
Reply
#3

Quote:
Originally Posted by [WinG]BiieL
Посмотреть сообщение
mete um timer pra ele destruir e depois recriar a textdraw, olha o FS de velocimetro do TiagoPS ele faz bem o q vc qr
@Bieel ERRADO! se destroir ele nгo vai aparecer Mais!.


@topic:
tenta.

pawn Код:
public OnGameModeInit()
{
SetTimer("chamar",100,true);
return 1;
}
forward chamar(playerid)
public chamar(playerid)
{
new string[256];
    format(string, 256, "                ~w~Kills:~r~ %d ~w~Deaths:~r~ %d ~w~Level:~r~ %d ~w~Exp:~r~ %d ~w~Estudos:~r~ %d", pap_CarregarInt(playerid, "Matou"), pap_CarregarInt(playerid, "Morreu"), pap_CarregarInt(playerid, "Level"), pap_CarregarInt(playerid, "Experiencia"), pap_CarregarInt(playerid, "Estudos"));
       TextDrawSetString(Infos, string);
    TextDrawShowForPlayer(playerid, Infos);
 return 1;
}
Reply
#4

Garfiel, eu fiz assim agora pouco, porйm buga, se tirar a parte que carrega as informaзхes vai normal, se nгo tirar da um bug na pap, ela fica aparecendo mensagem de aviso no console dizendo que nгo achou um arquivo da conta.
Reply
#5

entгo cara, tenta como eu disse
Reply
#6

Eu fiz desse jeito que vocк falou, usando um velocimetro que eu tinha criado. Tudo que use funзгo que atualize vai dar bug /acho
Reply
#7

vixi, tenta criar um textdraw pra cada informaзгo, ai ve se da
Reply
#8

Quote:
Originally Posted by [Full]Garfield[XDB]
Посмотреть сообщение
@Bieel ERRADO! se destroir ele nгo vai aparecer Mais!.


@topic:
tenta.

pawn Код:
public OnGameModeInit()
{
SetTimer("chamar",100,true);
return 1;
}
forward chamar(playerid)
public chamar(playerid)
{
new string[256];
    format(string, 256, "                ~w~Kills:~r~ %d ~w~Deaths:~r~ %d ~w~Level:~r~ %d ~w~Exp:~r~ %d ~w~Estudos:~r~ %d", pap_CarregarInt(playerid, "Matou"), pap_CarregarInt(playerid, "Morreu"), pap_CarregarInt(playerid, "Level"), pap_CarregarInt(playerid, "Experiencia"), pap_CarregarInt(playerid, "Estudos"));
       TextDrawSetString(Infos, string);
    TextDrawShowForPlayer(playerid, Infos);
 return 1;
}
tenta assim ^^

pawn Код:
public OnGameModeInit()
{
    SetTimer("chamar",100,true);
    return 1;
}
forward chamar(playerid)
public chamar(playerid)
{
    new string[256];
    format(string, 256, "                ~w~Kills:~r~ %d ~w~Deaths:~r~ %d ~w~Level:~r~ %d ~w~Exp:~r~ %d ~w~Estudos:~r~ %d", pap_CarregarInt(playerid, "Matou"), pap_CarregarInt(playerid, "Morreu"), pap_CarregarInt(playerid, "Level"), pap_CarregarInt(playerid, "Experiencia"), pap_CarregarInt(playerid, "Estudos"));
    TextDrawSetString(Infos, string);
    TextDrawHideForPlayer(playerid, Infos);
    TextDrawShowForPlayer(playerid, Infos);
    return 1;
}
Reply
#9

Nгo dб, й problema com a include.
Reply
#10

Em public OnGameModeInit()

pawn Код:
new string[256];
    format(string, 256, "                ~w~Kills:~r~ %d ~w~Deaths:~r~ %d ~w~Level:~r~ %d ~w~Exp:~r~ %d ~w~Estudos:~r~ %d", pap_CarregarInt(playerid, "Matou"), pap_CarregarInt(playerid, "Morreu"), pap_CarregarInt(playerid, "Level"), pap_CarregarInt(playerid, "Experiencia"), pap_CarregarInt(playerid, "Estudos"));
    Infos = TextDrawCreate(0,421.5,string);
    TextDrawUseBox(Infos,1);
    TextDrawBoxColor(Infos,0x00000066);
    TextDrawTextSize(barra,800,400);
    TextDrawAlignment(Infos,0);
    TextDrawBoxColor(barra, 126); //Cor do fundo
    TextDrawBackgroundColor(Infos,0x000000ff);
    TextDrawFont(Infos,1);
    TextDrawColor(Infos,0xffffffff);
    TextDrawSetOutline(Infos,1);
    TextDrawSetProportional(Infos,1);
    TextDrawSetShadow(Infos,1);
No Topo Do GM

pawn Код:
forward ATT();
no final do GM

pawn Код:
public ATT()
{
    TextDrawHideForPlayer(playerid, Infos);
    new string[256];
    format(string, 256, "                ~w~Kills:~r~ %d ~w~Deaths:~r~ %d ~w~Level:~r~ %d ~w~Exp:~r~ %d ~w~Estudos:~r~ %d", pap_CarregarInt(playerid, "Matou"), pap_CarregarInt(playerid, "Morreu"), pap_CarregarInt(playerid, "Level"), pap_CarregarInt(playerid, "Experiencia"), pap_CarregarInt(playerid, "Estudos"));
    TextDrawSetString(Infos, string);
    TextDrawShowForPlayer(playerid, Infos);
Agora em On Player Update

pawn Код:
public OnPlayerUpdate(playerid)
{
     ATT();
     return 1;
}
OnPlayerConnect

pawn Код:
ATT();
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)