Need help with dini making file -
ihatetn931 - 09.03.2010
Ok, so i have this code OnplayerConnect so when the player connect it creates the files but for some reason it's not creating a file can someone help me out?
pawn Код:
new str[128];
format(str, sizeof(str), "Cars/CarKeys/%s.%s.cfg", str);
if(dini_Exists(str))
{
strmid(CarKeys[playerid][cCarkey], dini_Get(str, "Vehicle1"), 0, strlen(dini_Get(str, "Vehicle1")), 255);
strmid(CarKeys[playerid][cCarkey2], dini_Get(str, "Vehicle2"), 0, strlen(dini_Get(str, "Vehicle2")), 255);
strmid(CarKeys[playerid][cCarkey3], dini_Get(str, "Vehicle3"), 0, strlen(dini_Get(str, "Vehicle3")), 255);
}
else
{
dini_Create(str);
strmid(CarKeys[playerid][cCarkey], "None", 0, strlen("None"), 255);
strmid(CarKeys[playerid][cCarkey2], "None", 0, strlen("None"), 255);
strmid(CarKeys[playerid][cCarkey3], "None", 0, strlen("None"), 255);
}
return 1;
}
Re: Need help with dini making file -
Backwardsman97 - 10.03.2010
Try removing that first period in your file name. That may be why.
Re: Need help with dini making file -
ihatetn931 - 10.03.2010
Quote:
|
Originally Posted by Backwardsman97
Try removing that first period in your file name. That may be why.
|
I have tried that. Here is the new code
pawn Код:
format(str, sizeof(str), "Cars/CarKeys/%s.cfg", str);
if(dini_Exists(str))
{
strmid(CarKeys[playerid][cCarkey], dini_Get(str, "Vehicle1"), 0, strlen(dini_Get(str, "Vehicle1")), 255);
strmid(CarKeys[playerid][cCarkey2], dini_Get(str, "Vehicle2"), 0, strlen(dini_Get(str, "Vehicle2")), 255);
strmid(CarKeys[playerid][cCarkey3], dini_Get(str, "Vehicle3"), 0, strlen(dini_Get(str, "Vehicle3")), 255);
}
else
{
dini_Create(str);
strmid(CarKeys[playerid][cCarkey], "None", 0, strlen("None"), 255);
strmid(CarKeys[playerid][cCarkey2], "None", 0, strlen("None"), 255);
strmid(CarKeys[playerid][cCarkey3], "None", 0, strlen("None"), 255);
}
return 1;
}
Note this is my first time using dini, I thought i would get to know it
Re: Need help with dini making file -
Backwardsman97 - 10.03.2010
Try maybe using '\' instead of '/' and see. That's the only thing I can think of.
Re: Need help with dini making file -
ihatetn931 - 10.03.2010
Quote:
|
Originally Posted by Backwardsman97
Try maybe using '\' instead of '/' and see. That's the only thing I can think of.
|
I tried it and i got this error
error 027: invalid character constant
If i say put the file in the folder (manually)
like i put
myname.cfg it writes the data to the file but it will not create the file. I can't make files manaully for each player it would be to time cousming and confusing
Re: Need help with dini making file -
Niixie - 10.03.2010
'\' means either that there comes a invalid char. try with '\\' maybe
Re: Need help with dini making file -
ihatetn931 - 10.03.2010
Quote:
|
Originally Posted by Niixie
'\' means either that there comes a invalid char. try with '\\' maybe
|
It compiled but it still dosen't create the file that it's suppose to
Re: Need help with dini making file -
Desert - 10.03.2010
I wonder why you make the string like this
format(str, sizeof(str), "Cars/CarKeys/%s.%s.cfg", str);
This would create a file name Cars/CarKeys/Cars/CarKeys.Cars/Carkeys.cfg
Plus try make it a .ini file
Re: Need help with dini making file -
Oxside - 10.03.2010
it must be \\ double \ yes? so it would be like this:
Cars\\CarKeys\\Cars\\CarKeys.Cars\\Carkeys.cfg
Re: Need help with dini making file -
pen_theGun - 10.03.2010
You are using 'format' wrong.
format(str, sizeof(str), "Cars/CarKeys/
%s.%s.cfg",
str);