GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Jcvag44800 le 27 Octobre 2011, 00:23:44

Titre: Raffraichir un TextDraw
Posté par: Jcvag44800 le 27 Octobre 2011, 00:23:44
Salut à tous !

Voilà, je cherches à rafraichir un textdraw :

    new sString[128] = "";
    new Text:stats = format(sString, sizeof(sString), "DM : %d", jdm1);
    TextDrawCreate(10.0, 0.10, sString);
    TextDrawUseBox(stats, 0);
TextDrawFont(stats, 3);
TextDrawSetShadow(stats,0);
TextDrawSetOutline(stats,1);
TextDrawBackgroundColor(stats,0x000000FF);
TextDrawColor(stats,0xFFFFFFFF);
TextDrawShowForPlayer(playerid, stats);

public OnPlayerUpdate(playerid)
{
    new newtext[256];
    format(newtext, sizeof(newtext), "DM : %d", jdm1);
    TextDrawSetString(stats, newtext);
    TextDrawShowForPlayer(playerid, stats);
return 1;
}

Cependant, il ne se raffraichi pas ...
Pouvez vous m'aidez ?

Merci

PS : Je remercie xartrick pour l'aide précieuse sur MSN ^^'
Titre: Re : Raffraichir un TextDraw
Posté par: Xartrick le 27 Octobre 2011, 00:43:55
La ligne deux est fausse, tu ne peux pas utiliser la fonction comme ceci.
La variable sString contient ta chaîne formaté et la variable stats contient l'indice du TextDraw créé.


new sString[64],
Text:stats;

format(sString, sizeof(sString), "DM: %d", jdm1);

stats = TextDrawCreate(10.0, 0.10, sString);

TextDrawUseBox(stats, 0);
TextDrawFont(stats, 3);
TextDrawSetShadow(stats, 0);
TextDrawSetOutline(stats, 1);
TextDrawBackgroundColor(stats, 0x000000FF);
TextDrawColor(stats, 0xFFFFFFFF);
TextDrawShowForPlayer(playerid, stats);
Titre: Re : Raffraichir un TextDraw
Posté par: Jcvag44800 le 27 Octobre 2011, 11:38:50
Merci à toi Xartrick !