SA-MP Forums

Go Back   SA-MP Forums > Non-English > Languages > Português/Portuguese

Reply
 
Thread Tools Display Modes
Old 26/08/2010, 09:23 PM   #1
[NWD]Tweener_
Gangsta
 
Join Date: May 2010
Posts: 591
Reputation: 2
Default [DUV] Atualizar TextDrawn

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 Code:
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);
[NWD]Tweener_ is offline   Reply With Quote
Old 26/08/2010, 09:27 PM   #2
BiieL
High-roller
 
BiieL's Avatar
 
Join Date: May 2010
Location: Fim de Mundo
Posts: 1,236
Reputation: 2
Default Re: [DUV] Atualizar TextDrawn

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 Code:
forward
    ChecarVelocimetro();
pawn Code:
SetTimer("ChecarVelocimetro", 500, 1);
pawn Code:
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
__________________
BiieL is offline   Reply With Quote
Old 26/08/2010, 09:33 PM   #3
zSuYaNw
Godfather
 
zSuYaNw's Avatar
 
Join Date: Apr 2010
Location: Santa Catarina
Posts: 6,844
Reputation: 670
Default Re: [DUV] Atualizar TextDrawn

Quote:
Originally Posted by [WinG]BiieL View Post
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 Code:
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;
}
zSuYaNw is offline   Reply With Quote
Old 26/08/2010, 09:57 PM   #4
[NWD]Tweener_
Gangsta
 
Join Date: May 2010
Posts: 591
Reputation: 2
Default Re: [DUV] Atualizar TextDrawn

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.
[NWD]Tweener_ is offline   Reply With Quote
Old 26/08/2010, 10:01 PM   #5
BiieL
High-roller
 
BiieL's Avatar
 
Join Date: May 2010
Location: Fim de Mundo
Posts: 1,236
Reputation: 2
Default Re: [DUV] Atualizar TextDrawn

então cara, tenta como eu disse
__________________
BiieL is offline   Reply With Quote
Old 26/08/2010, 10:07 PM   #6
[NWD]Tweener_
Gangsta
 
Join Date: May 2010
Posts: 591
Reputation: 2
Default Re: [DUV] Atualizar TextDrawn

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
[NWD]Tweener_ is offline   Reply With Quote
Old 26/08/2010, 10:10 PM   #7
BiieL
High-roller
 
BiieL's Avatar
 
Join Date: May 2010
Location: Fim de Mundo
Posts: 1,236
Reputation: 2
Default Re: [DUV] Atualizar TextDrawn

vixi, tenta criar um textdraw pra cada informação, ai ve se da
__________________
BiieL is offline   Reply With Quote
Old 26/08/2010, 10:51 PM   #8
Canabis
Huge Clucker
 
Canabis's Avatar
 
Join Date: Jul 2010
Location: Atraz de você!
Posts: 268
Reputation: 0
Default Re: [DUV] Atualizar TextDrawn

Quote:
Originally Posted by [Full]Garfield[XDB] View Post
@Bieel ERRADO! se destroir ele não vai aparecer Mais!.


@topic:
tenta.

pawn Code:
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 Code:
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;
}
__________________
Contato MSN: chefao.fusion@hotmail.com

as vezes a pessoa se preocupa tanto com as portas fechadas, que não se nota as que abre.


[INC]Poderoso Anti Money Hack


Canabis is offline   Reply With Quote
Old 26/08/2010, 11:01 PM   #9
[NWD]Tweener_
Gangsta
 
Join Date: May 2010
Posts: 591
Reputation: 2
Default Re: [DUV] Atualizar TextDrawn

Não dá, é problema com a include.
[NWD]Tweener_ is offline   Reply With Quote
Old 27/08/2010, 01:08 PM   #10
TiagoPS
Gangsta
 
TiagoPS's Avatar
 
Join Date: Mar 2010
Location: Dilma's Country
Posts: 846
Reputation: 4
Default Re: [DUV] Atualizar TextDrawn

Em public OnGameModeInit()

pawn Code:
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 Code:
forward ATT();

no final do GM

pawn Code:
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 Code:
public OnPlayerUpdate(playerid)
{
     ATT();
     return 1;
}

OnPlayerConnect

pawn Code:
ATT();
__________________
TiagoPS is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[DUV] Atualizar GM DartakousLien Português/Portuguese 3 15/05/2010 01:26 PM
Bottom textdrawn shoru93 Help Archive 0 02/02/2010 09:23 PM


All times are GMT. The time now is 11:10 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.