16
Scripting SA-MP [Pawn center] / [RESOLUT][Probleme] Chargement de fichier
« le: 18 Août 2010, 19:53:37 »
Salut tout le monde,
voila j'ai un petit probleme qui m'embette, j'essaye de faire un FS de biz complet (creation/edition/suppression/achat/vente...)(que je posterai), mon systeme de lecture marche mais pas come il faut, vous aller vite comprendre :
MON FICHIER BIZZ.INI :
MON SYSTEME DE LECTURE :
MES LOGS:
Comme vous l'avez remarqué, j'ai juste 1 seul biz a charger mais 13 se charge.
Plus:
1ere ligne = que des zéros et rien pour le nom et le proprio
2eme ligne = presque parfaite il manque le nom du biz ( TestBiz1 )
les autres lignes = décalage(truc bizarre)
derniere ligne = 13 Biz chargé au lieux de 1 ...
Voila comment faire?
voila j'ai un petit probleme qui m'embette, j'essaye de faire un FS de biz complet (creation/edition/suppression/achat/vente...)(que je posterai), mon systeme de lecture marche mais pas come il faut, vous aller vite comprendre :
MON FICHIER BIZZ.INI :
Code: (pawn) [Sélectionner]
Proprio=Personne
NomBiz=TestBiz1
PrixOrigine=1
EntreX=2186.476562
EntreY=1113.612915
EntreZ=12.648400
Interior=3
VirtualWorld=2000001
ExitX=974.017700
ExitY=-9.593700
ExitZ=1001.148376
PrixVente=1
PrixEntre=1
MON SYSTEME DE LECTURE :
Code: (pawn) [Sélectionner]
stock LoadBiz()
{
if(!fexist(BIZ_FILE))
{
printf("BTBIZ: Le fichier "#BIZ_FILE" n'existe pas.");
return 0;
}
new key[128],val[128], Data[256], ID = 0;
new File:bFile = fopen(BIZ_FILE, io_read);
if(bFile)
{
while (fread(bFile, Data))
{
key = ini_GetKey(Data);
if( strcmp( key , "Proprio" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][BizOwner] = strval( val ); }
if( strcmp( key , "NomBiz" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][BizNames] = strval( val ); }
if( strcmp( key , "PrixOrigine" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][BizCost] = strval( val ); }
if( strcmp( key , "EntreX" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][PickupX] = strval( val ); }
if( strcmp( key , "EntreY" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][PickupY] = strval( val ); }
if( strcmp( key , "EntreZ" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][PickupZ] = strval( val ); }
if( strcmp( key , "Interior" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][Interior] = strval( val ); }
if( strcmp( key , "VirtualWorld" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][Virtual] = strval( val ); }
if( strcmp( key , "ExitX" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][TeleX] = strval( val ); }
if( strcmp( key , "ExitY" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][TeleY] = strval( val ); }
if( strcmp( key , "ExitZ" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][TeleZ] = strval( val ); }
if( strcmp( key , "PrixVente" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][BizSell] = strval( val ); }
if( strcmp( key , "PrixEntre" , true ) == 0 ) { val = ini_GetValue( Data ); BizInfo[ID][BizEnter] = strval( val ); }
PickupID[ID] = CreatePickup(1273, 23, BizInfo[ID][PickupX], BizInfo[ID][PickupY], BizInfo[ID][PickupZ], -1); // Création des pickups
Create3DTextLabel("Bizz", 0x00A0F6AA, BizInfo[ID][PickupX], BizInfo[ID][PickupY], BizInfo[ID][PickupZ] + 0.75, 15.0, 0, 1); // Création des 3DText
printf("BTBIZ: Nom:%s Proprio:%s PrixEntre:%d PrixOrigine:%d PrixVente:%d Entre:%f,%f,%f Sortie:%f,%f,%f Int:%d VW:%d", BizInfo[ID][BizNames],
BizInfo[ID][BizOwner], BizInfo[ID][BizEnter], BizInfo[ID][BizCost], BizInfo[ID][BizSell], BizInfo[ID][PickupX], BizInfo[ID][PickupY], BizInfo[ID][PickupZ],
BizInfo[ID][TeleX], BizInfo[ID][TeleY], BizInfo[ID][TeleZ], BizInfo[ID][Interior], BizInfo[ID][Virtual]);
//}
ID++;
}
if(ID == 0)
{
fclose (bFile);
return 0;
}
fclose (bFile);
}
printf("BTBIZ: Nombre(s) de Biz presents au chargement: %d", ID);
fclose(bFile);
return 1;
}
MES LOGS:
Code: (pawn) [Sélectionner]
[19:15:49] Loading filter script 'BTBiz.amx'...
[19:15:49] -------------------------------------------------------
[19:15:49] | Chargement BTBiz by Brian Turner ... |
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[color=red][19:15:49] BTBIZ: Nom: Proprio:Personne PrixEntre:1 PrixOrigine:1 PrixVente:1 Entre:2186.476562,1113.612915,12.648400 Sortie:974.017700,-9.593700,1001.148376 Int:3 VW:2000001[/color]
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:1 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:2186.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,1113.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,12.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:3 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:2000001
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:974.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,-9.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,1001.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:0 PrixOrigine:0 PrixVente:1 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nom: Proprio: PrixEntre:1 PrixOrigine:0 PrixVente:0 Entre:0.000000,0.000000,0.000000 Sortie:0.000000,0.000000,0.000000 Int:0 VW:0
[19:15:49] BTBIZ: Nombre(s) de Biz presents au chargement: 13
Comme vous l'avez remarqué, j'ai juste 1 seul biz a charger mais 13 se charge.
Plus:
1ere ligne = que des zéros et rien pour le nom et le proprio
2eme ligne = presque parfaite il manque le nom du biz ( TestBiz1 )
les autres lignes = décalage(truc bizarre)
derniere ligne = 13 Biz chargé au lieux de 1 ...
Voila comment faire?