[Ajuda] Nao esta salvando
#1

E assim,eu guardo os carros do servidor,em 2 ficheiros. carspawns onde e guardado os carros do servidor e o carstand,onde guarda somente! os carros do stand
pawn Код:
carstand
so guarda carros do stand e o
pawn Код:
carspawn
guarda os restantes carros sem ser do stand.Ta ai os sistemas
pawn Код:
public LoadDynamicCars()
{
    new arrCoords[10][64];
    new strFromFile2[256];
    new string[128];
    new File: file = fopen("CRP_Scriptfiles/Cars/carspawns.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(DynamicCars))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            DynamicCars[idx][CarModel] = strval(arrCoords[0]);
            DynamicCars[idx][CarX] = floatstr(arrCoords[1]);
            DynamicCars[idx][CarY] = floatstr(arrCoords[2]);
            DynamicCars[idx][CarZ] = floatstr(arrCoords[3]);
            DynamicCars[idx][CarAngle] = floatstr(arrCoords[4]);
            DynamicCars[idx][CarColor1] = strval(arrCoords[5]);
            DynamicCars[idx][CarColor2] = strval(arrCoords[6]);
            DynamicCars[idx][FactionCar] = strval(arrCoords[7]);
            DynamicCars[idx][CarType] = strval(arrCoords[8]);
            DynamicCars[idx][Neon] = strval(arrCoords[9]);

            new vehicleid = CreateVehicle(DynamicCars[idx][CarModel],DynamicCars[idx][CarX],DynamicCars[idx][CarY],DynamicCars[idx][CarZ],DynamicCars[idx][CarAngle],DynamicCars[idx][CarColor1],DynamicCars[idx][CarColor2], -1);

            if(vehicleid <= 10)
            {
                format(string, sizeof(string), "0%d-%s-%d", vehicleid, MatriculasNames[vehicleid], vehicleid+15);
                SetVehicleNumberPlate(vehicleid,string);
            }
            else if(vehicleid <= 100 && vehicleid >= 10)
            {
                format(string, sizeof(string), "%d-%s-%d", vehicleid, MatriculasNames[vehicleid], vehicleid+15);
                SetVehicleNumberPlate(vehicleid,string);
            }
            else
            {
                format(string, sizeof(string), "%d-%s-%d", vehicleid-100, MatriculasNames[vehicleid], vehicleid-85);
                SetVehicleNumberPlate(vehicleid,string);
            }

            idx++;
        }
        fclose(file);
    }
    return 1;
}

public SaveDynamicCars()
{
    new idx;
    new File: file2;
    while (idx < sizeof(DynamicCars))
    {

        new coordsstring[512];
        format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d|%d|%d|%d\n",
        DynamicCars[idx][CarModel],
        DynamicCars[idx][CarX],
        DynamicCars[idx][CarY],
        DynamicCars[idx][CarZ],
        DynamicCars[idx][CarAngle],
        DynamicCars[idx][CarColor1],
        DynamicCars[idx][CarColor2],
        DynamicCars[idx][FactionCar],
        DynamicCars[idx][CarType],
        DynamicCars[idx][Neon]);

        if(idx == 0)
        {
            file2 = fopen("CRP_Scriptfiles/Cars/carspawns.cfg", io_write);
        }
        else
        {
            file2 = fopen("CRP_Scriptfiles/Cars/carspawns.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}

public LoadCars()
{
    new arrCoords[26][64];
    new strFromFile2[256];
    new File: file = fopen("CRP_Scriptfiles/Cars/carstand.cfg", io_read);
    if (file)
    {
        new idx= 0;
        while (idx < sizeof(Car))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(Car[idx][Owner], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            Car[idx][CarModel] = strval(arrCoords[1]);
            Car[idx][CarID] = strval(arrCoords[2]);
            Car[idx][ParkX] = floatstr(arrCoords[3]);
            Car[idx][ParkY] = floatstr(arrCoords[4]);
            Car[idx][ParkZ] = floatstr(arrCoords[5]);
            Car[idx][ParkAngle] = floatstr(arrCoords[6]);
            Car[idx][CarColor1] = strval(arrCoords[7]);
            Car[idx][CarColor2] = strval(arrCoords[8]);
            Car[idx][Owned] = strval(arrCoords[9]);
            Car[idx][Materials] = strval(arrCoords[10]);
            Car[idx][cCocaina] = strval(arrCoords[11]);
            Car[idx][cHeroina] = strval(arrCoords[12]);
            Car[idx][cExtasy] = strval(arrCoords[13]);
            Car[idx][cErva] = strval(arrCoords[14]);
            Car[idx][cPolen] = strval(arrCoords[15]);
            Car[idx][Locked] = strval(arrCoords[16]);
            Car[idx][Sell] = strval(arrCoords[17]);
            strmid(Car[idx][Matricula], arrCoords[18], 0, strlen(arrCoords[18]), 255);
            Car[idx][Matriculed] = strval(arrCoords[19]);
            strmid(Car[idx][GuardaArmas1], arrCoords[20], 0, strlen(arrCoords[20]), 255);
            strmid(Car[idx][GuardaArmas2], arrCoords[21], 0, strlen(arrCoords[21]), 255);
            strmid(Car[idx][GuardaArmas3], arrCoords[22], 0, strlen(arrCoords[22]), 255);
            strmid(Car[idx][GuardaArmas4], arrCoords[23], 0, strlen(arrCoords[23]), 255);
            strmid(Car[idx][GuardaArmas5], arrCoords[24], 0, strlen(arrCoords[24]), 255);
            Car[idx][Neon] = strval(arrCoords[25]);

            CreateVehicle(Car[idx][CarModel],Car[idx][ParkX],Car[idx][ParkY],Car[idx][ParkZ],Car[idx][ParkAngle],Car[idx][CarColor1],Car[idx][CarColor2], -1);

            if(Car[idx][Owned]== 1)
            {
                printf("[CARS:] CarID:%d  Dono:%s  Matricula:%s",idx,Car[idx][Owner], Car[idx][Matricula]);
            }

            if(Car[idx][Matriculed]== 1)
            {
                new string[128];
                format(string, sizeof(string), "%s", Car[idx][Matricula]);
                SetVehicleNumberPlate(idx,string);
            }
            idx++;
        }
        fclose(file);
    }
    return 1;
}

public SaveCars()
{
    new idx;
    new File: file2;
    while (idx < sizeof(Car))
    {

        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s|%d|%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%s|%d|%s|%s|%s|%s|%s|%d\n",
        Car[idx][Owner],
        Car[idx][CarModel],
        Car[idx][CarID],
        Car[idx][ParkX],
        Car[idx][ParkY],
        Car[idx][ParkZ],
        Car[idx][ParkAngle],
        Car[idx][CarColor1],
        Car[idx][CarColor2],
        Car[idx][Owned],
        Car[idx][Materials],
        Car[idx][cCocaina],
        Car[idx][cHeroina],
        Car[idx][cExtasy],
        Car[idx][cErva],
        Car[idx][cPolen],
        Car[idx][Locked],
        Car[idx][Sell],
        Car[idx][Matricula],
        Car[idx][Matriculed],
        Car[idx][GuardaArmas1],
        Car[idx][GuardaArmas2],
        Car[idx][GuardaArmas3],
        Car[idx][GuardaArmas4],
        Car[idx][GuardaArmas5],
        Car[idx][Neon]);

        if(idx == 0)
        {
            file2 = fopen("CRP_Scriptfiles/Cars/carstand.cfg", io_write);
        }
        else
        {
            file2 = fopen("CRP_Scriptfiles/Cars/carstand.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}
Nao sei o que se passa mas os carros sem ser do stand,salvam e depois "cria" os carros quando dase GMX,mas os carros do stand,salva(eu foi ver ficheiro e estava la uns numeros que devia ser do carro) e quando da GMX nao carrega '-' nao "cria" os carros do stand e agora?
Reply
#2

Se isso for uma filterscript ele nгo irб carregar apуs o GMX. Para carregar os FS apуs um GMX use: /rcon loadfs NOME_DO_FS.

Vai no wiki samp que lб tem todos os comandos via RCON: https://sampwiki.blast.hk/wiki/Advanced_...#RCON_Commands
Reply
#3

nao e FS,isso ai ta dentro do gamemode,e ta para salvar na public gamemode e carregar na public loadscript
Reply
#4

Alguem com alma de deus me ajuda!?
Reply
#5

Alguem me ajuda por favor?! Peзovos,imlprovos mas ajudem-me :`(
Reply
#6

Alguem me ajuda!?!??!
Reply
#7

Post quбdruplo, primeira vez que vejo.
Reply
#8

Quote:
Originally Posted by Pedro_Miranda
Посмотреть сообщение
Post quбdruplo, primeira vez que vejo.
record.
Reply
#9

Jб tive o mesmo problema que os carros nгo carregavam, ja tentas te fazer /resetallvehicles e depois dar restart?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)