How to Save VahicleHealth in Dini file?
#1

Код:
public SaveModsForAll(vehicleid)
{
new formatLD[256];
format(formatLD,sizeof(formatLD),"Sistema/Cars/%d.mods",vehicleid);
if(dini_Exists(formatLD))
{
dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
new Float:health; <--------- Don't Work
dini_IntSet(formatLD,"Health", GetVehicleHealth(vehicleid, health)); // <--------- Don't Work
}
else
{
dini_Create(formatLD);
dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
new Float:TuneCar[vehicleid][Health]; <--------- Don't Work
dini_IntSet(formatLD,"Health", GetVehicleHealth(vehicleid, TuneCar[vehicleid][Health])); <--------- Don't Work
}
return 0;
}
Thiss Code don't save the vehicle health!
Reply
#2

I never used dini, but isn't there "dini_FloatSet();" for doing this?

pawn Код:
new hp; GetVehicleHealth(vehicleid, hp);
dini_FloatSet(formatLD,"Health", hp);
And btw, your code will look better this way:
pawn Код:
public SaveModsForAll(vehicleid)
{
    new formatLD[256];
    format(formatLD,sizeof(formatLD),"Sistema/Cars/%d.mods",vehicleid);
    if(!dini_Exists(formatLD)) { dini_Create(formatLD); }

    dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
    dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
    dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
    dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
    dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
    dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
    dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
    dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
    dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
    dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
    dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
    dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
    dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
    dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
    dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
    dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
    dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
    dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
    dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
    new Float:health; GetVehicleHealth(vehicleid, health);
    dini_FloatSet(formatLD,"Health", health);
   
    return 1;
}
Reply
#3

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
I never used dini, but isn't there "dini_FloatSet();" for doing this?

pawn Код:
new hp; GetVehicleHealth(vehicleid, hp);
dini_FloatSet(formatLD,"Health", hp);
And btw, your code will look better this way:
pawn Код:
public SaveModsForAll(vehicleid)
{
    new formatLD[256];
    format(formatLD,sizeof(formatLD),"Sistema/Cars/%d.mods",vehicleid);
    if(!dini_Exists(formatLD)) { dini_Create(formatLD); }

    dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
    dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
    dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
    dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
    dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
    dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
    dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
    dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
    dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
    dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
    dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
    dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
    dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
    dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
    dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
    dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
    dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
    dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
    dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
    new Float:health; GetVehicleHealth(vehicleid, health);
    dini_FloatSet(formatLD,"Health", health);
   
    return 1;
}
Even better if he uses TuneCar[vehicleid][mod][0] to [17] instead of all those codes .
Reply
#4

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
I never used dini, but isn't there "dini_FloatSet();" for doing this?

pawn Код:
new hp; GetVehicleHealth(vehicleid, hp);
dini_FloatSet(formatLD,"Health", hp);
And btw, your code will look better this way:
pawn Код:
public SaveModsForAll(vehicleid)
{
    new formatLD[256];
    format(formatLD,sizeof(formatLD),"Sistema/Cars/%d.mods",vehicleid);
    if(!dini_Exists(formatLD)) { dini_Create(formatLD); }

    dini_IntSet(formatLD,"mod1",TuneCar[vehicleid][mod1]);
    dini_IntSet(formatLD,"mod2",TuneCar[vehicleid][mod2]);
    dini_IntSet(formatLD,"mod3",TuneCar[vehicleid][mod3]);
    dini_IntSet(formatLD,"mod4",TuneCar[vehicleid][mod4]);
    dini_IntSet(formatLD,"mod5",TuneCar[vehicleid][mod5]);
    dini_IntSet(formatLD,"mod6",TuneCar[vehicleid][mod6]);
    dini_IntSet(formatLD,"mod7",TuneCar[vehicleid][mod8]);
    dini_IntSet(formatLD,"mod9",TuneCar[vehicleid][mod9]);
    dini_IntSet(formatLD,"mod10",TuneCar[vehicleid][mod10]);
    dini_IntSet(formatLD,"mod11",TuneCar[vehicleid][mod11]);
    dini_IntSet(formatLD,"mod12",TuneCar[vehicleid][mod12]);
    dini_IntSet(formatLD,"mod13",TuneCar[vehicleid][mod13]);
    dini_IntSet(formatLD,"mod14",TuneCar[vehicleid][mod14]);
    dini_IntSet(formatLD,"mod15",TuneCar[vehicleid][mod15]);
    dini_IntSet(formatLD,"mod16",TuneCar[vehicleid][mod16]);
    dini_IntSet(formatLD,"mod17",TuneCar[vehicleid][mod17]);
    dini_IntSet(formatLD,"paintjob",TuneCar[vehicleid][paintjob]);
    dini_IntSet(formatLD,"color1",TuneCar[vehicleid][colorA]);
    dini_IntSet(formatLD,"color2",TuneCar[vehicleid][colorB]);
    new Float:health; GetVehicleHealth(vehicleid, health);
    dini_FloatSet(formatLD,"Health", health);
   
    return 1;
}
It works! thank you!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)