• 04 Juin 2026, 04:58:27


Auteur Sujet: [Probléme] TextDraw  (Lu 1691 fois)

0 Membres et 1 Invité sur ce sujet

Hors ligne mahad

  • *
  • Tueur en série
  • Messages: 114
    • Voir le profil
[Probléme] TextDraw
« le: 23 Janvier 2012, 21:47:41 »
Bonjour,

voila mon TextDraw fonctionne presque bien,
Tout s'affiche correctement,
par contre je suis l'id 1 par exemple, un nouveau joueur ce connect il prend l'id 2 et hop le TextDraw que je vois en temps que id 1 c'est le TextDraw de l'id 2

En gros le TextDraw prend que la dernière personne connecté

Comment faire pour que chaque personne puisse avoir sont propre TextDraw


Code Source : http://pastebin.com/qAh2w5aB

Merci d'avance


Hors ligne Xolokos

  • PAWN/XHTML/CSS/PHP/SQL/JS
  • *
  • Grand Banditisme
  • What are you waiting for ?
  • Messages: 681
    • Voir le profil
Re : [Probléme] TextDraw
« Réponse #1 le: 24 Janvier 2012, 12:43:30 »
Tu créer ton textdraw a la connexion uniquement pour le joueur qui ce connecte.
Sois :
playerInfo[playerid]= TextDrawCreate(210.0,506.000000,"_");
TextDrawUseBox(playerInfo[playerid],1);
TextDrawBoxColor(playerInfo[playerid],0x00000065);
TextDrawTextSize(playerInfo[playerid],625.000000,0.000000);
TextDrawAlignment(playerInfo[playerid],0);
TextDrawBackgroundColor(playerInfo[playerid],0x000000FF);
TextDrawFont(playerInfo[playerid],2);
TextDrawLetterSize(playerInfo[playerid],0.25,1.0);
TextDrawColor(playerInfo[playerid],0xFFFFFFFF);
TextDrawSetOutline(playerInfo[playerid],1);
TextDrawSetProportional(playerInfo[playerid],1);
TextDrawSetShadow(playerInfo[playerid],1);
TextDrawShowForPlayer(playerid,playerInfo[playerid]);

Puis tu le met a jour 2 secondes après avec ses information avec un Settimerex.
public playerInfo_show(i)
{
                new aspiration[LITTLE_STRING];
                new string[MAX_STRING];
                new enduPercent, enduStr[LITTLE_STRING],cagouleStr[24];
                aspi_getName(PlayerInfo[i][pAspiration], aspiration);
                enduPercent = floatround(  (float(PlayerInfo[i][pEndurance]) / (float(ENDU_MAX)+float(PlayerInfo[i][pEnduranceMax]))) * 100.0  );
                if(enduPercent <= 10)
                        {format(enduStr, LITTLE_STRING, "~R~%d%", enduPercent);}
                else if(enduPercent <= 25)
                        {format(enduStr, LITTLE_STRING, "~Y~%d%", enduPercent);}
                else
                        {format(enduStr, LITTLE_STRING, "~G~%d%", enduPercent);}
                // Bonheur
                new bonheurStr[LITTLE_STRING], bonheurPercent;
                bonheurPercent = PlayerInfo[i][pBonheur] / 2;
                if(PlayerInfo[i][pBonheur] < BONHEUR_HAPPY_LIMIT)
                        {format(bonheurStr, LITTLE_STRING, "~R~%d%", bonheurPercent);}
                else if(PlayerInfo[i][pBonheur] <= 75)
                        {format(bonheurStr, LITTLE_STRING, "~Y~%d%", bonheurPercent);}
                else
                        {format(bonheurStr, LITTLE_STRING, "~G~%d%", bonheurPercent);}
                // Accro
                new accroStr[LITTLE_STRING], accroName[LITTLE_STRING];
                accro_getName(PlayerInfo[i][pAccro], accroName);
                if(PlayerInfo[i][pAccro] != 0)
                        {format(accroStr, LITTLE_STRING, "~n~~B~Accro: ~w~%s", accroName);}
                else
                        {format(accroStr, LITTLE_STRING, "~n~~B~Accro: ~w~Aucun ");}
                // Maladie
                new sickStr[LITTLE_STRING], sickName[LITTLE_STRING];
                sick_getName(PlayerInfo[i][pSickId], sickName);
                if(PlayerInfo[i][pSickId] != 0)
                        {format(sickStr, LITTLE_STRING, "~n~~B~Maladie: ~w~%s", sickName);}
                else
                        {format(sickStr, LITTLE_STRING, "~n~~B~Maladie: ~w~Aucune ");}
                if(CagouleUse[i]==1)
                        {format(cagouleStr, 24, "~n~~Y~Cagoule mise");}
                else
                        {format(cagouleStr, 24, "       ");}
                format(string,sizeof(string),"~B~Bonheur: %s~n~~B~Endurance: ~w~%s~n~~B~Aspir.: ~w~%s%s%s%s~n~~B~Argent: ~g~$%d~n~~B~Compte: ~g~$%d", bonheurStr, enduStr, aspiration, accroStr, sickStr, cagouleStr, PlayerInfo[i][pCash], PlayerInfo[i][pAccount]);
                TextDrawSetString(playerInfo[i], string);
                //TextDrawShowForPlayer(i, playerInfo[i]); Pas besoin car tu le montre a la connexion.
}

Et a sa déconnexion tu le détruit ou le cache.
« Modifié: 24 Janvier 2012, 12:45:08 par Xolokos »
Nippah !

Hors ligne mahad

  • *
  • Tueur en série
  • Messages: 114
    • Voir le profil
Re : [Probléme] TextDraw
« Réponse #2 le: 24 Janvier 2012, 17:21:29 »
Merci a toi, je vais testé de suite cette solution

Double post
Voila, j'ai donc mis comme tu me la expliqué

Dans OnPlayerConnect

Mais il affiche pas la Boite ni le texte malgré le timer
« Modifié: 24 Janvier 2012, 17:49:04 par mahad »


Hors ligne Xolokos

  • PAWN/XHTML/CSS/PHP/SQL/JS
  • *
  • Grand Banditisme
  • What are you waiting for ?
  • Messages: 681
    • Voir le profil
Re : [Probléme] TextDraw
« Réponse #3 le: 26 Janvier 2012, 18:22:04 »
Au pire tu le met a jour des qu'il Spawn.
Nippah !

Hors ligne Ssk

  • *
  • Lulu's Stunt - Le serveur stunt de Lulu !
  • Messages: 8154
    • Voir le profil
Re : Re : [Probléme] TextDraw
« Réponse #4 le: 27 Janvier 2012, 13:06:52 »
Merci a toi, je vais testé de suite cette solution

Double post
Voila, j'ai donc mis comme tu me la expliqué

Dans OnPlayerConnect

Mais il affiche pas la Boite ni le texte malgré le timer

Les doubles post ne sont pas tolérés sur ce forum, le prochain je te met un avertissement.

http://www.gtaonline.fr/forums/index.php/topic,12060.0.html



Derrière tout programme se cache un programmeur, je considère le monde comme un programme.
Mon blog