[Ajuda] Coisa louca
#1

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
Reply
#2

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;
}
Reply
#3

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.
Reply
#4

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)