GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: mahad 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 (http://pastebin.com/qAh2w5aB)
Merci d'avance
-
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.
-
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
-
Au pire tu le met a jour des qu'il Spawn.
-
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 (http://www.gtaonline.fr/forums/index.php/topic,12060.0.html)