GTAOnline.net

San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: Jcvag44800 le 01 Mai 2011, 14:47:25

Titre: Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 14:47:25
Hello tout le monde !

Alors voilà,j'ai voulu faire un petit système multi langage, et voici se que j'ai fais :

    if(fexist(file))
    {
  if(PlayerInfo[playerid][pLangage] == 1)
  {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{008000}Vous êtes enregistré", "Bienvenue sur Fanatik Stunt !\n\nMerci d'entrer votre mot de passe ci-dessous pour vous connecter :", "Connect", "Quit");
  }
  if(PlayerInfo[playerid][pLangage] == 2)
  {
    ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "{008000}You are register", "Welcome to Fanatik Stunt !\n\nThank you to enter your password below to login :", "Login", "Leave");
  }

Cependant, le tableau ne s'affiche pas l'hors de la connexion, même si ma variable langage dans le fichier user est à 1 !!!
Comment y remédier svp

Merci
Titre: Re : Problème avec 2 variables
Posté par: cristab le 01 Mai 2011, 15:29:35
normale apparement ta variable reste a 0 car tu n'extrait pas la valeur de la variable dans le fichier
Titre: Re : Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 15:34:35
Salut,

Si si biensur, j'ai ma variable qui est à 1
L'hors de l'inscription, le joueur choisi entre Français et Anglais
Si il clique sur Français, la variable pLangage est à 1
Si il clique sur Anglais, la variable est à 2
Titre: Re : Problème avec 2 variables
Posté par: cristab le 01 Mai 2011, 15:49:30
fait comme sa est dit mais je suis sur elle est a 0

if(fexist(file))
    {
 if(PlayerInfo[playerid][pLangage] == 1)
 {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{008000}Vous êtes enregistré", "Bienvenue sur Fanatik Stunt !\n\nMerci d'entrer votre mot de passe ci-dessous pour vous connecter :", "Connect", "Quit");
   printf("plangage %d",PlayerInfo[playerid][pLangage]);
 }
 if(PlayerInfo[playerid][pLangage] == 2)
 {
   ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "{008000}You are register", "Welcome to Fanatik Stunt !\n\nThank you to enter your password below to login :", "Login", "Leave");
   printf("plangage %d",PlayerInfo[playerid][pLangage]);
 }
Titre: Re : Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 15:57:20
Bah apparament, elle est à 0
Mais elle est à 1 sur mon fichier User
Langage=1
Et je ne peux pas test ton code , car je n'ai pas le tableau qui s'affiche du coup
Je vais mettre
If(PlayerInfo[playerid][pLangage] == 0)

Pour voir si il s'affiche


PS: J'ai test et c'est bien à 0
[15:57:36] plangage 0
Titre: Re : Problème avec 2 variables
Posté par: cristab le 01 Mai 2011, 16:00:06
car tu n'as pas extrait la valeur de la variable dans le fichier ^^
Titre: Re : Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 16:10:13
D'accord :)

Comment faire s'il te plait ?

J’imagine qui faudra faire un new comme ceci :

new plangage = 0; ?
Titre: Re : Problème avec 2 variables
Posté par: cristab le 01 Mai 2011, 16:19:25
non sa pas besoin

comment ce presente ton systeme de gestion de fichier

sans sa je pourrais pas t'aider
Titre: Re : Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 16:20:33
C'est de cette base
http://forum.sa-mp.com/showthread.php?t=167937 (http://forum.sa-mp.com/showthread.php?t=167937)
Titre: Re : Problème avec 2 variables
Posté par: cristab le 01 Mai 2011, 16:32:57
donc

if(fexist(file))
    {
          PlayerInfo[playerid][pLangage] = dini_Int(file, "Langage");
 if(PlayerInfo[playerid][pLangage] == 1)
 {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "{008000}Vous êtes enregistré", "Bienvenue sur Fanatik Stunt !\n\nMerci d'entrer votre mot de passe ci-dessous pour vous connecter :", "Connect", "Quit");
 }
 if(PlayerInfo[playerid][pLangage] == 2)
 {
   ShowPlayerDialog(playerid, 4, DIALOG_STYLE_INPUT, "{008000}You are register", "Welcome to Fanatik Stunt !\n\nThank you to enter your password below to login :", "Login", "Leave");
 }
Titre: Re : Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 17:09:38
D'accord, merci Cristab

Je dois faire cette manipulation à chaque fois l'hors se que je veux récupérer une variable ?
Titre: Re : Problème avec 2 variables
Posté par: cristab le 01 Mai 2011, 17:11:38
non juste la apres elle changeras pas durant le temps de jeux du joueurs
Titre: Re : Problème avec 2 variables
Posté par: Jcvag44800 le 01 Mai 2011, 17:13:30
D'accord, merci encore ;)