Beiträge von Twojeks

    Mit sscanf versuche es mal so


    Ich bin auch drauf gekommen grade xD war aber net zu 100% sicher aber ging jetzt ^^


    // oder auch net -.-


    so habe ich es jetzt




    LoadVehicles()
    {
    new neons[] = {18647, 18648, 18649, 18650, 18651, 18652};
    new string[2000];
    new File:handle, count;
    new filename[2000], line[2000], s, key[64];
    for(new i=1; i < MAX_DVEHICLES; i++)
    {
    format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", i);
    if(!fexist(filename)) continue;
    handle = fopen(filename, io_read);
    while(fread(handle, line))
    {
    stripNewLine(line);
    s = strfind(line, "=");
    if(!line[0] || s < 1) continue;
    strmid(key, line, 0, s++);
    if(strcmp(key, "Created") == 0) VehicleCreated[i] = strval(line[s]);
    else if(strcmp(key, "Model") == 0) VehicleModel[i] = strval(line[s]);
    else if(strcmp(key, "Pos") == 0) sscanf(line[s], "p,ffff", VehiclePos[i][0], VehiclePos[i][1],
    VehiclePos[i][2], VehiclePos[i][3]);
    else if(strcmp(key, "Colors") == 0) sscanf(line[s], "p,dd", VehicleColor[i][0], VehicleColor[i][1]);
    else if(strcmp(key, "Interior") == 0) VehicleInterior[i] = strval(line[s]);
    else if(strcmp(key, "VirtualWorld") == 0) VehicleWorld[i] = strval(line[s]);
    else if(strcmp(key, "Owner") == 0) strmid(VehicleOwner[i], line, s, sizeof(line));
    else if(strcmp(key, "NumberPlate") == 0) strmid(VehicleNumberPlate[i], line, s, sizeof(line));
    else if(strcmp(key, "Value") == 0) VehicleValue[i] = strval(line[s]);
    else if(strcmp(key, "Lock") == 0) VehicleLock[i] = strval(line[s]);
    else if(strcmp(key, "Alarm") == 0) VehicleAlarm[i] = strval(line[s]);
    else if(strcmp(key, "Paintjob") == 0) VehiclePaintjob[i] = strval(line[s]);
    else if(strcmp(key, "Neon") == 0) Neon[i] = strval(line[s]);
    else
    {
    for(new t=0; t < sizeof(VehicleTrunk[]); t++)
    {
    format(string, sizeof(string), "Trunk%d", t+1);
    if(strcmp(key, string) == 0) sscanf(line[s], "p,dd", VehicleTrunk[i][t][0], VehicleTrunk[i][t][1]);
    }
    for(new m=0; m < sizeof(VehicleMods[]); m++)
    {
    format(string, sizeof(string), "Mod%d", m);
    if(strcmp(key, string) == 0) VehicleMods[i][m] = strval(line[s]);
    }
    }
    switch(Neon[i])//wie mache ich das an besten mit den abfragen ?
    {
    case 1:
    {
    neon1[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i], 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i], -0.94, 0, -0.48, 0, 0, 0);
    }
    case 2:
    {
    neon1[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i], 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i], -0.94, 0, -0.48, 0, 0, 0);
    }
    case 3:
    {
    neon1[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i], 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i], -0.94, 0, -0.48, 0, 0, 0);
    }
    case 4:
    {
    neon1[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i], 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i], -0.94, 0, -0.48, 0, 0, 0);
    }
    case 5:
    {
    neon1[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i], 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i], -0.94, 0, -0.48, 0, 0, 0);
    }
    case 6:
    {
    neon1[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(neons[Neon[i]-1], 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i], 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i], -0.94, 0, -0.48, 0, 0, 0);
    }
    }
    }
    fclose(handle);
    if(VehicleCreated[i]) count++;
    }
    printf("Loaded %d vehicles", count);
    }


    24 warnings

    Guten Abend..
    Ich wollte gerne die Neons die sich die Spieler anbringen speichern.
    Dieses habe ich mit Nummern gemacht 1 = rot, 2 = gelb usw,
    aber wie lasse ich diese jetzt an besten anbringen, beim laden der Fahrzeugen ?


    hier mal was ich bis jetzt habe



    LoadVehicles()
    {
    new string[2000];
    new File:handle, count;
    new filename[2000], line[2000], s, key[64];
    for(new i=1; i < MAX_DVEHICLES; i++)
    {
    format(filename, sizeof(filename), VEHICLE_FILE_PATH "v%d.ini", i);
    if(!fexist(filename)) continue;
    handle = fopen(filename, io_read);
    while(fread(handle, line))
    {
    stripNewLine(line);
    s = strfind(line, "=");
    if(!line[0] || s < 1) continue;
    strmid(key, line, 0, s++);
    if(strcmp(key, "Created") == 0) VehicleCreated[i] = strval(line[s]);
    else if(strcmp(key, "Model") == 0) VehicleModel[i] = strval(line[s]);
    else if(strcmp(key, "Pos") == 0) sscanf(line[s], "p,ffff", VehiclePos[i][0], VehiclePos[i][1],
    VehiclePos[i][2], VehiclePos[i][3]);
    else if(strcmp(key, "Colors") == 0) sscanf(line[s], "p,dd", VehicleColor[i][0], VehicleColor[i][1]);
    else if(strcmp(key, "Interior") == 0) VehicleInterior[i] = strval(line[s]);
    else if(strcmp(key, "VirtualWorld") == 0) VehicleWorld[i] = strval(line[s]);
    else if(strcmp(key, "Owner") == 0) strmid(VehicleOwner[i], line, s, sizeof(line));
    else if(strcmp(key, "NumberPlate") == 0) strmid(VehicleNumberPlate[i], line, s, sizeof(line));
    else if(strcmp(key, "Value") == 0) VehicleValue[i] = strval(line[s]);
    else if(strcmp(key, "Lock") == 0) VehicleLock[i] = strval(line[s]);
    else if(strcmp(key, "Alarm") == 0) VehicleAlarm[i] = strval(line[s]);
    else if(strcmp(key, "Paintjob") == 0) VehiclePaintjob[i] = strval(line[s]);
    else if(strcmp(key, "Neon") == 0) Neon[i] = strval(line[s]);
    else
    {
    for(new t=0; t < sizeof(VehicleTrunk[]); t++)
    {
    format(string, sizeof(string), "Trunk%d", t+1);
    if(strcmp(key, string) == 0) sscanf(line[s], "p,dd", VehicleTrunk[i][t][0], VehicleTrunk[i][t][1]);
    }
    for(new m=0; m < sizeof(VehicleMods[]); m++)
    {
    format(string, sizeof(string), "Mod%d", m);
    if(strcmp(key, string) == 0) VehicleMods[i][m] = strval(line[s]);
    }
    }
    switch(Neon[i])//wie mache ich das an besten mit den abfragen ?
    {
    case 1:
    {
    neon1[i] = CreateObject(18647, 0, 0, 0, 0, 0, 0);
    neon2[i] = CreateObject(18647, 0, 0, 0, 0, 0, 0);
    AttachObjectToVehicle(neon1[i), 0.94, 0, -0.48, 0, 0, 0);
    AttachObjectToVehicle(neon2[i), -0.94, 0, -0.48, 0, 0, 0);
    }
    }
    }
    fclose(handle);
    if(VehicleCreated[i]) count++;
    }
    printf("Loaded %d vehicles", count);
    }

    Hmm kommisch den die 1050ti hat eig auch einen externen strom anschluss, Ich selber habe die gleiche.
    Es wird wohl am Arbeitsspeicher liegen, Ich hatte auch ständige ruckler dann habe ich meinen von 8gb auf 16 erhöht.