Jump to content
  • 0

[Problema] Salvarea Masinilor.


Justone.

Question

Problema intalnita (descriere): Pai , intru frumos pe server dau /v create / /acreatecar , imi apare masina , dau restart la server si mi se salveaza in carkeys id-ul masini , dar in masini.cfg nu se salveaza masina creeata.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu): Nu stiu de unde a aparut problema.
Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da , am adaugat un alt sistem de masini , degeaba la fel face.

Serverul este pe DINI

Edited by Floryn1992
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

public SaveCarCoords()
{
    new idx;
    new File: file2;
    while (idx < sizeof(CarInfo))
    {
        new coordsstring2[256];
        format(coordsstring2, sizeof(coordsstring2), "%d|%f|%f|%f|%f|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
        CarInfo[idx][cModel],
        CarInfo[idx][cLocationx],
        CarInfo[idx][cLocationy],
        CarInfo[idx][cLocationz],
        CarInfo[idx][cAngle],
        CarInfo[idx][cColorOne],
        CarInfo[idx][cColorTwo],
        CarInfo[idx][mod1],
        CarInfo[idx][mod2],
        CarInfo[idx][mod3],
        CarInfo[idx][mod4],
        CarInfo[idx][mod5],
        CarInfo[idx][mod6],
        CarInfo[idx][mod7],
        CarInfo[idx][mod8],
        CarInfo[idx][mod9],
        CarInfo[idx][mod10],
        CarInfo[idx][mod11],
        CarInfo[idx][mod12],
        CarInfo[idx][mod13],
        CarInfo[idx][mod14],
        CarInfo[idx][mod15],
        CarInfo[idx][mod16],
        CarInfo[idx][mod17],
        CarInfo[idx][paintjob]);
        if(idx == carsonserver)
        {
            file2 = fopen("pcars.cfg", io_write);
        }
        else
        {
            file2 = fopen("pcars.cfg", io_append);
        }
        fwrite(file2, coordsstring2);
        idx++;
        fclose(file2);
    }
    return 1;
}



public OnCarUpdate()
{
    new idx, File: file2;
    idx = carsonserver;
     while (idx < sizeof(CarInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
        CarInfo[idx][cModel],
        CarInfo[idx][cLocationx],
        CarInfo[idx][cLocationy],
        CarInfo[idx][cLocationz],
        CarInfo[idx][cAngle],
        CarInfo[idx][cColorOne],
        CarInfo[idx][cColorTwo],
        CarInfo[idx][cOwner],
        CarInfo[idx][cDescription],
        CarInfo[idx][cPlate1],
        CarInfo[idx][cPlate2],
        CarInfo[idx][cPlate3],
        //CarInfo[idx][cValue],
        CarInfo[idx][cOwned],
        CarInfo[idx][mod1],
        CarInfo[idx][mod2],
        CarInfo[idx][mod3],
        CarInfo[idx][mod4],
        CarInfo[idx][mod5],
        CarInfo[idx][mod6],
        CarInfo[idx][mod7],
        CarInfo[idx][mod8],
        CarInfo[idx][mod9],
        CarInfo[idx][mod10],
        CarInfo[idx][mod11],
        CarInfo[idx][mod12],
        CarInfo[idx][mod13],
        CarInfo[idx][mod14],
        CarInfo[idx][mod15],
        CarInfo[idx][mod16],
        CarInfo[idx][mod17],
        CarInfo[idx][paintjob]);
        if(idx == carsonserver)
        {
            file2 = fopen("pcars.cfg", io_write);
        }
        else
        {
            file2 = fopen("pcars.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}

 

OFF : Si la mare lucrezi la ma ? :))

Edited by Floryn1992
Link to comment
Share on other sites

  • 0

if(strcmp(x_nr,"create",true) == 0)
            {
                if(PlayerInfo[playerid][pLevel] >= 3)
                {
                    if(PlayerInfo[playerid][pPcarkey] == -1 && PlayerInfo[playerid][pPcarkey2] == -1 && PlayerInfo[playerid][pPcarkey3] == -1)
                    {
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "{FF0000}[USAGE]{B4B5B7}: /v create [carid] [color1] [color2]"); return 1; }
                        new car = strval(tmp);
                        if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Vehicle Number can't be below 400 or above 611 !"); return 1; }
                        if(IsInvalidVehicleId(car) == 0)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "Invalid vehicle model !"); return 1;
                        }
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "{FF0000}[USAGE]{B4B5B7}: /v create [carid] [color1] [color2]"); return 1; }
                        new color1 = strval(tmp);
                        if(color1 < 0 || color1 > 255) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 255 !"); return 1; }
                        tmp = strtok(cmdtext, idx);
                        if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "{FF0000}[USAGE]{B4B5B7}: /v create [carid] [color1] [color2]"); return 1; }
                        new color2 = strval(tmp);
                        if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 255 !"); return 1; }

                        new thiscar, Float:X, Float:Y, Float:Z;
                        GetPlayerPos(playerid, X, Y, Z);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        thiscar = CreateVehicle(car, X, Y, Z, 1, color1, color2, -1);

                        strmid(CarInfo[thiscar][cOwner], sendername, 0, strlen(sendername), 999);
                        format(CarInfo[thiscar][cDescription], 32, "%s", vehName[GetVehicleModel(thiscar) - 400]);

                        CarInfo[thiscar][cOwned] = 1;
                        CarInfo[thiscar][cModel] = car;
                        CarInfo[thiscar][cColorOne] = color1;
                        CarInfo[thiscar][cColorTwo] = color2;
                        CarInfo[thiscar][cLocationx] = X;
                        CarInfo[thiscar][cLocationy] = Y;
                        CarInfo[thiscar][cLocationz] = Z;
                        CarInfo[thiscar][cAngle] = 1;

                        if(PlayerInfo[playerid][pPcarkey] == -1) { PlayerInfo[playerid][pPcarkey] = thiscar; }
                        else if(PlayerInfo[playerid][pPcarkey2] == -1) { PlayerInfo[playerid][pPcarkey2] = thiscar; }
                        else if(PlayerInfo[playerid][pPcarkey3] == -1) { PlayerInfo[playerid][pPcarkey3] = thiscar; }

                        strmid(CarInfo[thiscar][cPlate1], "LS", 0, strlen("LS"), 999);
                        strmid(CarInfo[thiscar][cPlate2], "666", 0, strlen("666"), 999);
                        strmid(CarInfo[thiscar][cPlate3], "BNZ", 0, strlen("BNZ"), 999);
                        format(TextCar, sizeof(TextCar), "%s-%s-%s", CarInfo[thiscar][cPlate1], CarInfo[thiscar][cPlate2], CarInfo[thiscar][cPlate3]);
                        TextUpCar[thiscar] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1);
                        Attach3DTextLabelToVehicle(TextUpCar[thiscar], thiscar, 0.0, 0.0, 0.1);
                        OnCarUpdate(), SavePlayerData(playerid);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "Ai deja o masina creeata de tine !");
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_WHITE, "Trebuie sa ai level 3 pentru a creea o masina personala !");
                }
                return 1;
            }

 

if(strcmp(cmd, "/acreatecar", true) == 0)
    {
        if(PlayerInfo[playerid][pAdmin] >= 1339 || IsPlayerAdmin(playerid))
         {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GREY, "USAGE: /acreatecar [carid] [color1] [color2] [playerid]");
                return 1;
            }
            new car = strval(tmp);
            if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Vehicle Number can't be below 400 or above 611 !"); return 1; }

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /acreatecar [carid] [color1] [color2] [playerid]"); return 1; }
            new color1 = strval(tmp);
            if(color1 < 0 || color1 > 255) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 255 !"); return 1; }

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /acreatecar [carid] [color1] [color2] [playerid]"); return 1; }
            new color2 = strval(tmp);
            if(color2 < 0 || color2 > 255) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Color Number can't be below 0 or above 255 !"); return 1; }

            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GREY, "USAGE: /acreatecar [carid] [color1] [color2] [playerid]"); return 1; }
            giveplayerid = strval(tmp);
            if(giveplayerid < 0 || giveplayerid > GetMaxPlayers()) { SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Acest numar de jucatori nu exista !"); return 1; }

            if(IsPlayerConnected(giveplayerid))
            {
                if(PlayerInfo[giveplayerid][pPcarkey] != -1 && PlayerInfo[giveplayerid][pPcarkey2] != -1 && PlayerInfo[giveplayerid][pPcarkey3] != -1)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Acest jucator nu mai are sloturi libere !");
                }
                else
                {
                    new thiscar, Float:X, Float:Y, Float:Z;
                    GetPlayerPos(playerid, X, Y, Z);
                    GetPlayerName(giveplayerid, sendername, sizeof(sendername));
                    thiscar = CreateVehicle(car, X, Y, Z, 1, color1, color2, -1);

                    strmid(CarInfo[thiscar][cOwner], sendername, 0, strlen(sendername), 999);
                    format(CarInfo[thiscar][cDescription], 32, "%s", vehName[GetVehicleModel(thiscar) - 400]);

                    CarInfo[thiscar][cOwned] = 1;
                    CarInfo[thiscar][cModel] = car;
                    CarInfo[thiscar][cColorOne] = color1;
                    CarInfo[thiscar][cColorTwo] = color2;
                    CarInfo[thiscar][cLocationx] = X;
                    CarInfo[thiscar][cLocationy] = Y;
                    CarInfo[thiscar][cLocationz] = Z;
                    CarInfo[thiscar][cAngle] = 1;
                      CarInfo[thiscar][paintjob] = -1;

                    if(PlayerInfo[giveplayerid][pPcarkey] == -1) { PlayerInfo[giveplayerid][pPcarkey] = thiscar; }
                    else if(PlayerInfo[giveplayerid][pPcarkey2] == -1) { PlayerInfo[giveplayerid][pPcarkey2] = thiscar; }
                    else if(PlayerInfo[giveplayerid][pPcarkey3] == -1) { PlayerInfo[giveplayerid][pPcarkey3] = thiscar; }

                    strmid(CarInfo[thiscar][cPlate1], "LS", 0, strlen("LS"), 999);
                    strmid(CarInfo[thiscar][cPlate2], "666", 0, strlen("666"), 999);
                    strmid(CarInfo[thiscar][cPlate3], "TST", 0, strlen("TST"), 999);
                    format(TextCar, sizeof(TextCar), "%s-%s-%s", CarInfo[thiscar][cPlate1], CarInfo[thiscar][cPlate2], CarInfo[thiscar][cPlate3]);
                    TextUpCar[thiscar] = Create3DTextLabel(TextCar, 0x33AAFFFF , 0.0, 0.0, 0.0, 25, 0, 1);
                    Attach3DTextLabelToVehicle(TextUpCar[thiscar], thiscar, 0.0, 0.0, 0.1);

                    LoadComponents(thiscar), OnCarUpdate(), SavePlayerData(giveplayerid);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_WHITE, "{0950F7}* Acest jucator nu este conectat !");
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, " You are not authorized to use that command ");
        }
        return 1;
    }

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.