SA-MP Forums Archive
[Ajuda] Coisa louca - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Coisa louca (/showthread.php?tid=476355)



Coisa louca - Don_Speed - 17.11.2013

E uma coisa muito louca eu tava criando uma textdraw .
Mas quando eu tomo spawn ela aparece e logo que vai atualizar ela some novamente .

codigos
PHP код:
new Text:CashInfo[MAX_PLAYERS];
// OnPlayerConnect
    
CashInfo[playerid] = TextDrawCreate(486.000000120.000000"Cash: 000");
    
TextDrawBackgroundColor(CashInfo[playerid], 255);
    
TextDrawFont(CashInfo[playerid], 1);
    
TextDrawLetterSize(CashInfo[playerid], 0.4300001.500000);
    
TextDrawColor(CashInfo[playerid], -1);
    
TextDrawSetProportional(CashInfo[playerid], 1);
    
TextDrawSetShadow(CashInfo[playerid], 1);
//OnPlayerSpawn
    
TextDrawShowForPlayer(playeridCashInfo[playerid]);
    
SetTimerEx("AtualizarText"1000true"ui"playeridPlayer[playerid][pGold]);
forward AtualizarText(playeridgold);
public 
AtualizarText(playeridgold)
{
    new 
str[80];
    
format(strsizeof(str), "Cash: %i "gold);
    
TextDrawSetString(CashInfo[playerid], str);
    return 
true;

Qual e o erro ai



Re: Coisa louca - Gii - 17.11.2013

pawn Код:
forward AtualizarText(playerid, gold);
public AtualizarText(playerid, gold)
{
    new str[80];
    format(str, sizeof(str), "Cash: %i ", gold);
    TextDrawSetString(CashInfo[playerid], str);
    TextDrawShowForPlayer(playerid, CashInfo[playerid]);
    return true;
}



Re: Coisa louca - Don_Speed - 17.11.2013

Quote:
Originally Posted by iCasTiel
Посмотреть сообщение
pawn Код:
forward AtualizarText(playerid, gold);
public AtualizarText(playerid, gold)
{
    new str[80];
    format(str, sizeof(str), "Cash: %i ", gold);
    TextDrawSetString(CashInfo[playerid], str);
    TextDrawShowForPlayer(playerid, CashInfo[playerid]);
    return true;
}
Mesma coisa aparece ai some.



Re: Coisa louca - Locky_ - 17.11.2013

Tira o espaзo do final do string
pawn Код:
format(str, sizeof(str), "Cash: %i", gold);



Re: Coisa louca - Gii - 17.11.2013

pawn Код:
new Text:CashInfo[MAX_PLAYERS];
new Str[128];

enum pInfo {

    pGold

};

new Player[MAX_PLAYERS][pInfo];

public OnPlayerConnect(playerid) {

    CashInfo[playerid] = TextDrawCreate(486.000000, 120.000000, "");
    TextDrawBackgroundColor(CashInfo[playerid], 255);
    TextDrawFont(CashInfo[playerid], 1);
    TextDrawLetterSize(CashInfo[playerid], 0.430000, 1.500000);
    TextDrawColor(CashInfo[playerid], -1);
    TextDrawSetProportional(CashInfo[playerid], 1);
    TextDrawSetShadow(CashInfo[playerid], 1);

    return 1;
}

forward Atualizar(playerid);
public Atualizar(playerid)
{
    format(Str,sizeof(Str),"Cash %d", Player[playerid][pGold]);
    TextDrawSetString(CashInfo[playerid], Str);
    TextDrawShowForPlayer(playerid, CashInfo[playerid]);
    return 1;
}

public OnPlayerSpawn(playerid)
{
    SetTimerEx("Atualizar", 1000, true, "i", playerid);
    return 1;
}
Bom, testei aqui e funcionou, adapte como quiser.