y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
First of all, i would like to thank you for creating y_ini script
I want to create script to save and load buyed vehicles (on player connect) in GM
I've got working saving but the script won't load data from ini file
OnPlayerConnect
Код:
new fileName[]="users_vehicles/Mato0.ini";
if(fexist(fileName)){
INI_ParseFile(fileName, "loadVehicle", .bPassTag=true);
}
file exists so it calls the function
Код:
forward loadVehicle(tag[], name[], value[]);
public loadVehicle(tag[], name[], value[]){
new vehID, Float:vehHealth, Float:vehPosX, Float:vehPosY, Float:vehPosZ, Float:vehZAngle, vehInterior, vehColor1, vehColor2, vehPaintjob;
INI_Int("vID", vehID);
INI_Float("vHealth", vehHealth);
INI_Float("vPosX", vehPosX);
INI_Float("vPosY", vehPosY);
INI_Float("vPosZ", vehPosZ);
INI_Float("vZAngle", vehZAngle);
INI_Int("vInterior", vehInterior);
INI_Int("vColor1", vehColor1);
INI_Int("vColor1", vehColor2);
INI_Int("vPaintjob", vehPaintjob);
printf("%d, %.1f, %.1f, %.1f, %.1f, %.1f, %d, %d, %d, %d", vehID, vehHealth, vehPosX, vehPosY, vehPosZ, vehZAngle, vehInterior, vehColor1, vehColor2, vehPaintjob);
}
(I removed the part of code that creates the vehicle for now, otherwise i've got it in code)
the function starts but it will print all zeros

i read whole tutorial for y_ini and did everything what was there but i don't know what to do know

can anybody help me, please ?
this is the .ini file:
Код:
vID = 562
vHealth = 1000.000000
vPosX = 2074.495361
vPosY = 1685.016357
vPosZ = 10.302776
vZAngle = 178.577453
vInterior = 0
vColor1 = 1
vColor2 = 1
vPaintjob = 1
Re: y_ini - INI_ParseFile Help -
Hansrutger - 02.01.2014
I think you are supposed to send a tag along with it when you use INI_ParseFile. Not sure about tags as I don't really use them:
INI_ParseFile(fileName, "loadVehicle", .bPassTag=true, .extra = TheTagYouWantToSend);
Sorry if this is wrong, I very much dislike tags as they screwed up something for me when I began to write my first script so I just use files.
Re: y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
I don't use tags too
Re: y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
In my login/register system i use same function and everything and it works great without tag
but if i have to set a tag, can you help me please ?
Re: y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
it was in tutorial:
Quote:
Originally Posted by ******
Load a whole file at once:
pawn Код:
forward LoadOneFile(tag[], name[], value[]); public LoadOneFile(tag[], name[], value[]) { }
pawn Код:
INI_ParseFile("myini.ini", "LoadOneFile", .bPassTag = true);
|
so I though it should be there, but if i remove .bPassTag = true it's not working either
Re: y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
I don't want to use tags
is it possible that it don't want to write values to variables because variables are declared in that public ? (I think no, but to be sure

)
Re: y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
but variables is used in the function that should read them
pawn Код:
new vehID, Float:vehHealth, Float:vehPosX, Float:vehPosY, Float:vehPosZ, Float:vehZAngle, vehInterior, vehColor1, vehColor2, vehPaintjob;
INI_Int("vID", vehID);
INI_Float("vHealth", vehHealth);
INI_Float("vPosX", vehPosX);
INI_Float("vPosY", vehPosY);
INI_Float("vPosZ", vehPosZ);
INI_Float("vZAngle", vehZAngle);
INI_Int("vInterior", vehInterior);
INI_Int("vColor1", vehColor1);
INI_Int("vColor1", vehColor2);
INI_Int("vPaintjob", vehPaintjob);
printf("%d, %.1f, %.1f, %.1f, %.1f, %.1f, %d, %d, %d, %d", vehID, vehHealth, vehPosX, vehPosY, vehPosZ, vehZAngle, vehInterior, vehColor1, vehColor2, vehPaintjob);
and all that printf prints is "0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0, 0"
that's my problem
Re: y_ini - INI_ParseFile Help -
MatoC9 - 02.01.2014
that printf is in the function that loads the data from ini file
don't know why should INI_Int end the function, in login parsefile it works just fine