PDA

View Full Version : [HELP] Dynamic race loading Y_Ini


Luca12
29/04/2015, 06:53 PM
Hello. So I post this but please if someone with better pawn knowledge can reply. Thanks.

So I have dynamic race loading event written in Y_Ini and the problem is when I load some race from first time all cps are 0.0000 but when I load the race again from second time then all cps are fine.

Here's the code

inline loadracedata(string:name[],string:value[])
{
new scps[64];
INI_String("ImeUtrke",UtrkaInfo[utrkaNaziv],128);
INI_Int("BrojCP",UtrkaInfo[utrkaBrojCP]);
INI_String("Rekorder",UtrkaInfo[utrkaRekorder],128);
INI_Int("RekordMinuti",UtrkaInfo[utrkaRekordMinuti]);
INI_Int("RekordSekunde",UtrkaInfo[utrkaRekordSekunde]);
INI_Int("Krugova",UtrkaInfo[utrkaKrugova]);
INI_Int("Vozila",UtrkaInfo[utrkaVozila]);
INI_Int("Zadnji_CP",UtrkaInfo[utrkaZadnjiCP]);
INI_Float("CP_Radius",UtrkaInfo[CPRadius]);
for(new cpsrc = 0; cpsrc < UtrkaInfo[utrkaBrojCP]+1; cpsrc++)
{
format(scps,sizeof(scps),"CP_%d_PosX",cpsrc);
INI_Float(scps,CPInfo[cpsrc][cpX]);
printf("CPX = %.4f",CPInfo[cpsrc][cpX]);

format(scps,sizeof(scps),"CP_%d_PosY",cpsrc);
INI_Float(scps,CPInfo[cpsrc][cpY]);
printf("CPX = %.4f",CPInfo[cpsrc][cpY]);

format(scps,sizeof(scps),"CP_%d_PosZ",cpsrc);
INI_Float(scps,CPInfo[cpsrc][cpZ]);
printf("CPX = %.4f",CPInfo[cpsrc][cpZ]);

format(scps,sizeof(scps),"CP_%d_Prolaz",cpsrc);
INI_Int(scps,CPInfo[cpsrc][utrkaProlaz]);

format(scps,sizeof(scps),"CP_%d_Krug",cpsrc);
INI_Int(scps,CPInfo[cpsrc][utrkaKrug]);
}
}
INI_ParseFile(FolderRaces(utrkafile),"loadracedata");

Luca12
30/04/2015, 04:35 PM
anyone? thanks

Luca12
01/05/2015, 11:50 AM
anyone? thanks

Mencent
01/05/2015, 12:35 PM
Hello!

What is printing in the loop?
inline loadracedata(string:name[],string:value[])
{
new scps[64];
INI_String("ImeUtrke",UtrkaInfo[utrkaNaziv],128);
INI_Int("BrojCP",UtrkaInfo[utrkaBrojCP]);
INI_String("Rekorder",UtrkaInfo[utrkaRekorder],128);
INI_Int("RekordMinuti",UtrkaInfo[utrkaRekordMinuti]);
INI_Int("RekordSekunde",UtrkaInfo[utrkaRekordSekunde]);
INI_Int("Krugova",UtrkaInfo[utrkaKrugova]);
INI_Int("Vozila",UtrkaInfo[utrkaVozila]);
INI_Int("Zadnji_CP",UtrkaInfo[utrkaZadnjiCP]);
INI_Float("CP_Radius",UtrkaInfo[CPRadius]);
for(new cpsrc = 0; cpsrc < UtrkaInfo[utrkaBrojCP]+1; cpsrc++)
{
printf("cpsrc: %i - UltrkaInfo[utrkaBrojCP]: %i",cpsrc,UltrkaInfo[utrkaBrojCP]);
format(scps,sizeof(scps),"CP_%d_PosX",cpsrc);
INI_Float(scps,CPInfo[cpsrc][cpX]);
printf("CPX = %.4f",CPInfo[cpsrc][cpX]);

format(scps,sizeof(scps),"CP_%d_PosY",cpsrc);
INI_Float(scps,CPInfo[cpsrc][cpY]);
printf("CPX = %.4f",CPInfo[cpsrc][cpY]);

format(scps,sizeof(scps),"CP_%d_PosZ",cpsrc);
INI_Float(scps,CPInfo[cpsrc][cpZ]);
printf("CPX = %.4f",CPInfo[cpsrc][cpZ]);

format(scps,sizeof(scps),"CP_%d_Prolaz",cpsrc);
INI_Int(scps,CPInfo[cpsrc][utrkaProlaz]);

format(scps,sizeof(scps),"CP_%d_Krug",cpsrc);
INI_Int(scps,CPInfo[cpsrc][utrkaKrug]);
}
}
INI_ParseFile(FolderRaces(utrkafile),"loadracedata");

Luca12
01/05/2015, 01:44 PM
from first time when I load it prints all cps with float 0.0000 but when I load that race again then cps are fine loaded

Luca12
03/05/2015, 08:26 AM
anyone? thanks