Cars won't load!
#1

I made a vehicle ownership system, but for some reason the cars won't load when the server restarts, could you guys have a look at this?

Код:
stock LoadVehicle(filename[36], name[], value[])
{
	new model, vx, vy, vz, vfa, col1, col2;
    INI_Int("Model", model);
    INI_Float("x", vx);
    INI_Float("y", vy);
    INI_Float("z", vz);
    INI_Float("fa", vfa);
    INI_Int("color1", col1);
    INI_Int("color2", col2);
    CreateVehicleEx(model, vx, vy, vz, vfa, col1, col2);
}

stock LoadAllVehicles()
{
    new fname[36];
    new index = 0;
    format(fname, sizeof(fname), "/POV/%i.ini", index);
    while(fexist(fname))
    {
        format(fname, sizeof(fname), "/POV/%i.ini", index);
        INI_ParseFile(fname, "LoadVehicle");
        index ++;
    }
}
Under GameModeInit:
Код:
	LoadAllVehicles();
Reply
#2

Can we see your SaveVehicle function?
Reply
#3

Certainly.

Код:
stock SaveVehicle(vehicle, filename[36])
{
	new INI:iniFile = INI_Open(filename);
	INI_SetTag(iniFile, "data");
	INI_WriteInt(iniFile, "Model", vInfo[vehicle][Model]);
	INI_WriteFloat(iniFile, "x", vInfo[vehicle][vPos_x]);
	INI_WriteFloat(iniFile, "y", vInfo[vehicle][vPos_y]);
	INI_WriteFloat(iniFile, "z", vInfo[vehicle][vPos_z]);
    INI_WriteFloat(iniFile, "fa", vInfo[vehicle][vAngle]);
    INI_WriteInt(iniFile, "color1", vInfo[vehicle][vcolor1]);
    INI_WriteInt(iniFile, "color2", vInfo[vehicle][vcolor2]);
    INI_WriteInt(iniFile, "locked", vInfo[vehicle][locked]);
    INI_Close(iniFile);
 }
Reply
#4

The code looks fine to me from what I can see, you might want to assign a print message to the LoadVehicle function and see what result it gives you

printf("Loading vehicle type %d at %f, %f, %f", model, vx, vy, vz);

And do the vehicles even save?
Reply
#5

The vehicles save properly, they just won't spawn into the world on restart.
I added the print message line, but it won't print anything into the console.
Is it possible that my LoadVehicle function is not being executed properly or not being executed at all?
Reply
#6

bump, really need help
Reply
#7

Kinda have the same problem but with MySQL.. really pisses me off.
Reply
#8

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)