Problem CarownerShip.
#1

Hello.I have a problem in systems of cars ....

When I acreatecar all goes well .. Give / apark | / park, but if I restart the server not saved cars, masini.cfg exist scriptfile | Look here is the code. to save car ..



Код:
public LoadCar()
{
    new arrCoords[31][64];
    new strFromFile2[256];
    new veh;
    new File: file = fopen("masini.cfg", io_read);
    if (file)
    {
        new idx = carsonserver;
        while (idx < sizeof(CarInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, ',');
            CarInfo[idx][cModel] = strval(arrCoords[0]);
            CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
            CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
            CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
            CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
            CarInfo[idx][cColorOne] = strval(arrCoords[5]);
            CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
            strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
            strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            CarInfo[idx][cValue] = strval(arrCoords[9]);
            strmid(CarInfo[idx][cLicense], arrCoords[10], 0, strlen(arrCoords[10]), 255);
            CarInfo[idx][cOwned] = strval(arrCoords[11]);
            CarInfo[idx][cLock] = strval(arrCoords[12]);
            CarInfo[idx][mod1] = strval(arrCoords[13]);
            CarInfo[idx][mod2] = strval(arrCoords[14]);
            CarInfo[idx][mod3] = strval(arrCoords[15]);
            CarInfo[idx][mod4] = strval(arrCoords[16]);
            CarInfo[idx][mod5] = strval(arrCoords[17]);
            CarInfo[idx][mod6] = strval(arrCoords[18]);
            CarInfo[idx][mod7] = strval(arrCoords[19]);
            CarInfo[idx][mod8] = strval(arrCoords[20]);
            CarInfo[idx][mod9] = strval(arrCoords[21]);
            CarInfo[idx][mod10] = strval(arrCoords[22]);
            CarInfo[idx][mod11] = strval(arrCoords[23]);
            CarInfo[idx][mod12] = strval(arrCoords[24]);
            CarInfo[idx][mod13] = strval(arrCoords[25]);
            CarInfo[idx][mod14] = strval(arrCoords[26]);
            CarInfo[idx][mod15] = strval(arrCoords[27]);
            CarInfo[idx][mod16] = strval(arrCoords[28]);
            CarInfo[idx][mod17] = strval(arrCoords[29]);
            CarInfo[idx][paintjob] = strval(arrCoords[30]);
            veh = CreateVehicle(CarInfo[idx][cModel], CarInfo[idx][cLocationx],CarInfo[idx][cLocationy],CarInfo[idx][cLocationz],CarInfo[idx][cAngle],CarInfo[idx][cColorOne],CarInfo[idx][cColorTwo],999999999);
            ChangeVehiclePaintjob(veh, CarInfo[idx][paintjob]);
            if(CarInfo[idx][cLock]) SetVehicleParamsEx(PlayerInfo[idx][pCar], 0, 0, 0, 1, 0, 0, 0);
            AddVehicleComponent(veh, CarInfo[idx][mod1]);
            AddVehicleComponent(veh, CarInfo[idx][mod2]);
            AddVehicleComponent(veh, CarInfo[idx][mod3]);
            AddVehicleComponent(veh, CarInfo[idx][mod4]);
            AddVehicleComponent(veh, CarInfo[idx][mod5]);
            AddVehicleComponent(veh, CarInfo[idx][mod6]);
            AddVehicleComponent(veh, CarInfo[idx][mod7]);
            AddVehicleComponent(veh, CarInfo[idx][mod8]);
            AddVehicleComponent(veh, CarInfo[idx][mod9]);
            AddVehicleComponent(veh, CarInfo[idx][mod10]);
            AddVehicleComponent(veh, CarInfo[idx][mod11]);
            AddVehicleComponent(veh, CarInfo[idx][mod12]);
            AddVehicleComponent(veh, CarInfo[idx][mod13]);
            AddVehicleComponent(veh, CarInfo[idx][mod14]);
            AddVehicleComponent(veh, CarInfo[idx][mod15]);
            AddVehicleComponent(veh, CarInfo[idx][mod16]);
            AddVehicleComponent(veh, CarInfo[idx][mod17]);
            printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
            idx++;
        }
    }
    return 1;
}
Reply
#2

This is the code to Load Cars
pawn Код:
public LoadCar()
{
Reply
#3

...
This is the code.

LoadCar....
Reply
#4

That code takes the cars from the file and adds it to the server, you need the opposite, taking it from the server and adding it to the file...
Reply
#5

I'm kind of a beginner, I do not know, you leave a link to download gamemode, maybe I'll help you, if you have time and want to, I have this problem for a long time. nobody even knew how to do it ..

Sorry my bad english

gm pwn
Reply
#6

UP ? please
Reply
#7

Please Helppppp
Reply
#8

Pleaseee Help me 3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)