saving car colors -
Adamsy - 23.08.2016
Hi,
I'm trying to save my vehicle colors
I managed to save it but I don't know how to load it.
Here is the system to load vehicle color:
pawn Код:
ONGAMEMODEINIT
// AddStaticVehicle... //
{
new filename[256];
format(filename, sizeof(filename), "%d", 0);
carcolor1 = dini_Int(filename, "carcolor1");
carcolor1 = dini_Int(filename, "carcolor2");
ChangeVehicleColor(xxxxxxx, carcolor1, carcolor2);
}
what should I put instead xxxxxxx so it recognizes
all AddStaticVehicle ?
I think I must stock them but I don't know how explain me please.
Re: saving car colors -
Shinja - 23.08.2016
You save vehicles, each vehicle in own file with name "0" "1"... ?
Show where you save and how
Re: saving car colors -
Adamsy - 23.08.2016
Yes the gamemode I took save them like that.
But the problem is not to save, it's already done as you can see, but
how to load for each.
located in
scriptfiles
gamemode
Re: saving car colors -
Shinja - 23.08.2016
PHP код:
for(new i, j=GetVehiclePoolSize(); i<=j; i++)
{
ChangeVehicleColors(i, dini_Int(i, "carcolor1"), dini_Int(i, "carcolor2"));
}
Re: saving car colors -
Adamsy - 23.08.2016
I had to change it to:
pawn Код:
for(new i, j=GetVehiclePoolSize(); i<=j; i++)
{
new filename[256];
format(filename, sizeof(filename), "%d", i);
carcolor1 = dini_Int(filename, "carcolor1");
carcolor2 = dini_Int(filename, "carcolor2");
ChangeVehicleColor(i, carcolor1, carcolor2);
}
to get it to work, thank you !
Re: saving car colors -
Shinja - 23.08.2016
Quote:
Originally Posted by Shinja
PHP код:
for(new i, j=GetVehiclePoolSize(); i<=j; i++)
{
ChangeVehicleColors(i, dini_Int(i, "carcolor1"), dini_Int(i, "carcolor2"));
}
|
This don't work?
anyway, don't define variable inside a loop, and 256, aloooot, 5 is more than enough in this case
PHP код:
new filename[5];
for(new i, j=GetVehiclePoolSize(); i<=j; i++)
{
format(filename, sizeof(filename), "%d", i);
carcolor1 = dini_Int(filename, "carcolor1");
carcolor2 = dini_Int(filename, "carcolor2");
ChangeVehicleColor(i, carcolor1, carcolor2);
}
Re: saving car colors -
Adamsy - 24.08.2016
Nope I didn't work, I got error while compiling.
Okay, thanks for the tip, I changed it.