GTAOnline.net
San Andreas Multiplayer (sa:mp) => Scripting SA-MP [Pawn center] => Discussion démarrée par: DarkZeroX le 04 Novembre 2013, 18:57:40
-
Salut,
j'ai un problème avec le chargement ça crash al fonction au premier pX
public chargerScriptInt()
{
printf("Okei1");
if(fexist(SCRIPT))
{
printf("Okei2");
new File:intFiles = fopen(SCRIPT, io_read);
printf("Okei3");
new intstring[512];
printf("Okei4");
static Field[32][64];
printf("Okei5");
while(fread(intFiles, intstring, sizeof(intstring)))
{
printf("Okei6");
if(split2(intstring, Field, '|') == 10)
{
Info_Interieur[interieursCharges][pX] = floatstr(Field[0]);
Info_Interieur[interieursCharges][pY] = floatstr(Field[1]);
Info_Interieur[interieursCharges][pZ] = floatstr(Field[2]);
Info_Interieur[interieursCharges][preA] = floatstr(Field[3]);
Info_Interieur[interieursCharges][pInt] = strval(Field[4]);
format(Info_Interieur[interieursCharges][info], MAX_PLAYER_NAME*3, "%s", Field[5]);
interieursCharges++;
printf("Interieur chargé : %f %f %f",Info_Interieur[interieursCharges][pX],Info_Interieur[interieursCharges][pY],Info_Interieur[interieursCharges][pZ]);
}
}
}
fclose(intFiles);
}
-
Bonjour,
Il serait bon que tu complètes un peu ton message. Décris-nous ton problème, ce que tu as essayé, ce qui ne semble pas fonctionner, ce que ton code est censé faire... En l'état actuel des choses, je suis incapable de t'aider (et c'est sans-doute pareil pour les autres) car je n'ai strictement aucune idée de ce que ton code est censé faire (et dans quel système il s'imbrique).
Avec un peu (beaucoup) plus de renseignements de ta part, on pourrait t'aider bien plus facilement. À titre d'exemple, tu utilises la variable/constante/je-ne-sais-quoi SCRIPT mais nous ne savons pas à quoi elle correspond. Il y a de fortes chances que le problème vienne de là.
-
Ce code consiste à chargé des intérieurs (qui son tous dans le même fichier) pour ensuite les sauvegardé dans des variables. Et j'ai remarqué que dès le premier FLOAT ce charge la fonction crash tout. Si je met un PRINTF après le premier FLOAT la console crash complétement 'SCRIPT' = le nom du fichier en #define
public chargerScriptInt()
{
printf("Okei1");
if(fexist(SCRIPT)) // Si le fichier existe.
{
printf("Okei2");
new File:intFiles = fopen(SCRIPT, io_read); // On l'ouvre
printf("Okei3");
new intstring[512];
printf("Okei4");
static Field[32][64];
printf("Okei5");
while(fread(intFiles, intstring, sizeof(intstring)))
{
printf("Okei6");
if(split2(intstring, Field, '|') == 10)
{
Info_Interieur[interieursCharges][pX] = floatstr(Field[0]);
// ICI SA CRASH SI JE MET UN PRINTF ET SI JE LAISSE COMME SA LA FONCTION CRASH
Info_Interieur[interieursCharges][pY] = floatstr(Field[1]);
Info_Interieur[interieursCharges][pZ] = floatstr(Field[2]);
Info_Interieur[interieursCharges][preA] = floatstr(Field[3]);
Info_Interieur[interieursCharges][pInt] = strval(Field[4]);
format(Info_Interieur[interieursCharges][info], MAX_PLAYER_NAME*3, "%s", Field[5]);
interieursCharges++;
printf("Interieur chargé : %f %f %f",Info_Interieur[interieursCharges][pX],Info_Interieur[interieursCharges][pY],Info_Interieur[interieursCharges][pZ]);
}
}
}
fclose(intFiles);
}