saving car colors
#1

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.
Reply
#2

You save vehicles, each vehicle in own file with name "0" "1"... ?
Show where you save and how
Reply
#3

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
Reply
#4

PHP код:
for(new ij=GetVehiclePoolSize(); i<=ji++)
{
    
ChangeVehicleColors(idini_Int(i"carcolor1"), dini_Int(i"carcolor2"));

Reply
#5

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 !
Reply
#6

Quote:
Originally Posted by Shinja
Посмотреть сообщение
PHP код:
for(new ij=GetVehiclePoolSize(); i<=ji++)
{
    
ChangeVehicleColors(idini_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 
ij=GetVehiclePoolSize(); i<=ji++)
    {
    
format(filenamesizeof(filename), "%d"i);
    
carcolor1 dini_Int(filename"carcolor1");
    
carcolor2 dini_Int(filename"carcolor2");
    
ChangeVehicleColor(icarcolor1carcolor2);
    } 
Reply
#7

Nope I didn't work, I got error while compiling.

Okay, thanks for the tip, I changed it.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)