CarSystem Problem

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo,
    also ich habe versucht ein Carsystem reinzumachen ..
    Doch irgendwie bekomme ich immer Exe Crash, sobald ich auf den Server joine, weil ich das drin habe:


    for(new h = 302; h < sizeof(CarInfo); h++)
    {
    CreateVehicle(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],-1);
    }


    und wenn ich das rausnehme, erstellt der nicht die Fahrzeuge vom Carsystem ..
    Hoffe jemand kann mir helfen.
    Mfg

  • hab die sufu schon benutzt -.- 3. x jetz schon

  • der lädt die autos von einer datei:


    (cars.cfg)


    536,2118.743408,-1140.133666,24.724407,304.783538,3,0,Dealership,Blade,70000,,0,1
    536,294.928253,-1540.994262,24.334249,55.086307,37,1,Dealership,Blade,70000,,0,0
    566,298.460296,-1536.339843,24.374507,55.268928,66,66,Dealership,Tahoma,70000,,0,0
    567,1910.563110,-1116.947631,25.557451,179.626678,79,79,Allen_Smith,Savanna,80000,,1,0
    567,2134.719482,-1144.467651,24.714576,88.031745,7,7,Dealership,Savanna,80000,,0,0
    567,2492.492919,-1684.854736,13.291721,89.407608,86,86,Jordan_Edwards,Savanna,80000,,1,1
    402,552.088073,-1290.700317,17.079881,359.873565,3,0,Dealership,Buffalo,150000,,0,0
    412,2804.019531,-1554.826293,10.759739,173.570419,0,0,Amadeo_Gonzalez,Voodo,80000,,1,1
    475,2134.968261,-1140.843139,25.045583,89.505828,1,0,Dealership,Sabre,79000,,0,0
    475,2480.232177,-1653.140014,13.194861,268.707763,86,86,Jordan_Edwards,Sabre,79000,,1,1
    492,2135.619140,-1130.164306,25.434009,89.521537,86,0,Dealership,Greenwood,80000,,0,0
    517,292.262115,-1545.385986,24.448646,54.753906,86,86,Dealership,Majestic,79000,,0,0
    491,281.710571,-1530.951538,24.350019,232.892089,0,1,Dealership,Virgo,100000,,0,0
    534,278.028656,-1534.923950,24.338096,236.158432,11,11,Dealership,Remmington,100000,,0,0
    550,2135.916992,-1126.636108,25.337848,87.172729,3,3,Dealership,Sunrise,100000,,0,0
    565,528.652893,-1290.666015,16.867523,0.013407,3,0,Dealership,Flash,115000,,0,0
    405,2119.030273,-1128.910278,25.190202,306.100921,0,0,Dealership,Sentinel,90000,,0,0
    602,535.426818,-1290.568481,17.048688,0.278414,11,0,Dealership,Alpha,90000,,0,0
    445,1446.557495,-634.597534,95.477806,176.631072,0,0,Jope_Boyy,Admiral,80000,,1,0
    533,2118.054931,-1144.129882,24.465200,303.027893,-1,-1,Dealership,Feltzer,100000,,0,0
    421,2118.820800,-1136.373046,25.090425,307.679687,0,0,Dealership,Washington,100000,,0,0
    480,555.425170,-1290.579467,17.021947,0.382422,25,1,Dealership,Stafford,115000,,0,0
    551,2851.951171,-1326.562988,10.642333,94.098251,44,44,Hakeem_Seriki,Merit,80000,,1,0
    533,2118.702392,-1132.808959,24.974693,306.682189,0,0,Dealership,Feltzer,100000,,0,0
    579,2506.454589,-1518.953491,23.860540,268.338562,0,0,Dealership,Huntley,175000,,0,0
    400,2533.244873,-1521.400024,24.027200,87.671600,101,1,Dealership,Landstalker,115000,,0,0
    422,2533.862548,-1517.461181,23.941179,86.455230,86,0,Dealership,Bobcat,50000,,0,0
    422,2507.009521,-1525.578002,23.802551,270.340026,0,1,Dealership,Bobcat,50000,,0,0
    482,2509.912841,-1538.983520,23.710260,325.086791,44,0,Dealership,Burrito,60000,,0,1
    482,1053.330322,-1921.774902,13.073174,269.208831,0,0,James_Forest,Burrito,60000,,1,0
    554,2525.636474,-1537.338867,23.600700,0.981998,45,32,Dealership,Yosemite,115000,,0,0
    554,2521.861816,-1536.941284,23.506412,4.942471,0,0,Dealership,Yosemite,115000,,0,0
    500,2529.157470,-1536.960571,23.658634,2.168452,7,7,Dealership,Mesa,80000,,0,0
    500,2515.951660,-1538.419067,23.722114,359.756042,6,0,Dealership,Mesa,80000,,0,0
    489,2507.159179,-1533.208374,23.827999,275.118988,120,123,Dealership,Rancher,140000,,0,0
    489,2507.000488,-1529.187866,23.894399,273.747406,14,123,Dealership,Rancher,140000,,0,0
    400,2506.506835,-1522.165283,23.950422,268.515136,0,0,Dealership,Landstalker,115000,,0,1
    400,2533.710205,-1529.081054,23.898115,90.210159,0,0,Dealership,Landstalker,115000,,0,0
    579,2534.025634,-1525.698608,23.928392,89.510055,0,0,Dealership,Huntley,175000,,0,1
    579,2509.762695,-1686.933715,13.491580,47.030929,86,86,Jordan_Edwards,Huntley,175000,,1,1
    555,558.713073,-1290.837890,16.931600,0.209398,58,1,Dealership,Windsor,170000,,0,0
    541,548.686157,-1290.607910,16.873189,359.799560,0,6,Dealership,Bullet,350000,,0,0
    429,515.677856,-1299.191040,16.921865,50.869464,1,6,Dealership,Banshee,250000,,0,0
    415,538.819519,-1290.844726,17.014287,0.405654,1,1,Dealership,Cheetah,400000,,0,0
    480,545.303283,-1290.734008,16.903345,0.875015,0,0,Dealership,Comet,180000,,0,0
    562,521.353820,-1290.665283,16.901237,358.251007,75,0,Dealership,Elegy,250000,,0,0
    411,541.999389,-1291.161743,16.969274,1.809221,70,70,Dealership,Infernus,420000,,0,0
    559,564.094909,-1272.593017,16.898546,102.527946,3,3,Dealership,Jester,240000,,0,0
    561,532.249206,-1290.556518,17.058300,359.574188,8,17,Dealership,Stratum,230000,,0,0
    560,565.128112,-1291.287597,16.953615,359.084075,11,0,Dealership,Sultan,270000,,0,0
    558,525.131774,-1290.402221,16.874200,357.272003,117,1,Dealership,Uranus,245000,,0,0
    477,514.357116,-1302.358398,16.999300,53.507999,94,1,Dealership,ZR-350,280000,,0,0
    451,564.467651,-1276.005981,16.948564,102.954307,6,0,Dealership,Turismo,420000,,0,0
    462,2148.713134,-1199.034057,23.490591,91.535720,7,7,Dealership,Faggio,10000,,0,0
    462,1904.728393,-1128.295654,24.196571,97.695335,79,79,Burkhard_Walker,Faggio,10000,,1,0
    462,1560.944946,-2258.332031,13.146800,272.140197,0,0,Jope_Boyy,Faggio,10000,,1,0
    461,2148.276611,-1157.275634,23.423591,90.499389,6,6,Dealership,PCJ-600,40000,,0,0
    461,2161.549072,-1152.783691,23.501203,269.267974,0,0,Dealership,PCJ-600,40000,,0,0
    461,2161.161132,-1143.764160,24.414472,270.442993,3,0,Dealership,PCJ-600,40000,,0,0
    461,2161.198486,-1148.255126,23.974163,270.838867,43,43,Dealership,PCJ-600,40000,,0,0
    461,2161.457763,-1158.176757,23.414112,269.070800,0,0,Dealership,PCJ-600,40000,,0,1
    463,2148.677734,-1138.492065,25.030324,90.233436,3,0,Dealership,Freeway,30000,,0,0
    463,2148.258789,-1143.423706,24.493173,91.569236,79,79,Dealership,Freeway,30000,,0,1
    463,2148.359130,-1153.060424,23.430162,90.268531,3,1,Dealership,Freeway,30000,,0,0
    463,2148.933837,-1133.764038,25.107547,86.750137,3,3,Dealership,Freeway,30000,,0,0
    463,2148.867187,-1148.218627,23.960084,90.436462,0,0,Dealership,Freeway,30000,,0,0
    463,1560.979858,-2253.974609,13.087491,273.952758,0,0,Amadeo_Gonzalez,Freeway,30000,,1,0
    445,299.810607,-1503.363647,24.366800,234.676101,39,39,Dealership,Admiral,90000,,0,0
    445,296.592590,-1508.395385,24.362300,233.258193,45,45,Dealership,Admiral,90000,,0,0
    492,293.413909,-1512.717651,24.325899,234.520706,81,27,Dealership,Greenwood,80000,,0,0
    518,300.293395,-1490.822265,24.264499,233.683898,33,0,Dealership,Buccaneer,60000,,0,0
    566,303.546997,-1486.286743,24.452199,234.603805,95,1,Dealership,Tahoma,80000,,0,0
    567,306.532501,-1481.435791,24.460699,235.073501,90,96,Dealership,Savanna,80000,,0,0
    580,290.725311,-1518.189819,24.389900,233.932006,67,67,Dealership,Stafford,75000,,0,0
    600,287.938598,-1522.353759,24.313299,235.176406,67,8,Dealership,Picador,60000,,0,0
    468,2161.586914,-1162.433959,23.479799,273.594085,46,46,Dealership,Sanchez,40000,,0,0
    468,2161.842285,-1168.216796,23.485200,269.191406,3,3,Dealership,Sanchez,40000,,0,0
    468,2161.573730,-1173.019531,23.487800,275.272888,53,53,Dealership,Sanchez,40000,,0,0
    481,2161.362792,-1178.229248,23.329999,268.333496,46,46,Dealership,BMX,5000,,0,0
    481,2161.250488,-1182.665405,23.330099,264.850097,14,1,Dealership,BMX,5000,,0,0
    481,2161.297119,-1187.682739,23.332000,267.851898,26,1,Dealership,BMX,5000,,0,0
    481,2161.284912,-1192.840454,23.334999,264.963897,3,3,Dealership,BMX,5000,,0,0
    509,2161.078369,-1196.753784,23.377798,269.077392,25,1,Dealership,Bike,5000,,0,0
    509,2149.543457,-1203.484375,23.357000,82.926300,36,1,Dealership,Bike,5000,,0,0

  • hä ? sollen das 302 autos heißen ?
    oO eig sollte das heißen ab carid 302 ?!!!

  • enum cInfo
    {
    cModel,
    Float:cLocationx,
    Float:cLocationy,
    Float:cLocationz,
    Float:cAngle,
    cColorOne,
    cColorTwo,
    cOwner[MAX_PLAYER_NAME],
    cDescription[MAX_PLAYER_NAME],
    cValue,
    cLicense[MAX_PLAYER_NAME],
    cRegistration,
    cOwned,
    cLock,
    };


    new CarInfo[84][cInfo];


    davor warens 302


    nun habe ich 84 aus allen gemacht .. doch nun spawnen keine autos :@

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • kein wunder wenn deine schleife bei 302 Anfängt dann fängt er im Index von 302 zu laden
    dort sind aber bestimmt keine Autos eingetragen in der Variable, dann müsstest du beim Laden
    der Autos also dem Laden aus der Datei auch beim 302 anfangen und hochzählen.


    Du müsstest in der schleife bei 0 anfangen und bis zu Größe des Index der Var CarInfo gehen also 84

    Mfg. BlackFoX_UD_ alias [BFX]Explosion


  • }
    for(new h = 84; h < sizeof(CarInfo); h++)
    {
    SetVehicleParamsForPlayer(h,playerid,0,CarInfo[h][cLock]);


    muss ich da jetz z.b. eine 1 hinamchen statt doe 84 ?

  • hab alles probiert nix geht -.- hab bei allem eine 1 hingemacht ..



    habs so zuerst


    enum cInfo
    {
    cModel,
    Float:cLocationx,
    Float:cLocationy,
    Float:cLocationz,
    Float:cAngle,
    cColorOne,
    cColorTwo,
    cOwner[MAX_PLAYER_NAME],
    cDescription[MAX_PLAYER_NAME],
    cValue,
    cLicense[MAX_PLAYER_NAME],
    cRegistration,
    cOwned,
    cLock,
    };


    new CarInfo[1][cInfo];


    }


    public LoadCar()
    {
    new arrCoords[13][64];
    new strFromFile2[256];
    new File: file = fopen("cars.cfg", io_read);
    if (file)
    {
    new idx = 1;
    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]), 999);
    strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 999);
    CarInfo[idx][cValue] = strval(arrCoords[9]);
    strmid(CarInfo[idx][cLicense],arrCoords[10],0,strlen(arrCoords[10]),999);
    CarInfo[idx][cOwned] = strval(arrCoords[11]);
    CarInfo[idx][cLock] = strval(arrCoords[12]);
    printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
    if(CarInfo[idx][cOwned]==0) { gCarLock[idx]=0; }
    idx++;
    }
    }
    return 1;
    }


    for(new h = 1; h < sizeof(CarInfo); h++)
    {
    CreateVehicle(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],-1);
    }
    idx = 1;
    while (idx < sizeof(CarInfo))
    {
    new coordsstring[256];
    format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%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][cValue],
    CarInfo[idx][cLicense],
    CarInfo[idx][cOwned],
    CarInfo[idx][cLock]);
    if(idx == 1)
    {
    file2 = fopen("cars.cfg", io_write);
    }
    else
    {
    file2 = fopen("cars.cfg", io_append);
    }
    fwrite(file2, coordsstring);
    idx++;
    fclose(file2);


    }


    public LoadCar()
    {
    new arrCoords[13][64];
    new strFromFile2[256];
    new File: file = fopen("cars.cfg", io_read);
    if (file)
    {
    new idx = 1;
    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]), 999);
    strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 999);
    CarInfo[idx][cValue] = strval(arrCoords[9]);
    strmid(CarInfo[idx][cLicense],arrCoords[10],0,strlen(arrCoords[10]),999);
    CarInfo[idx][cOwned] = strval(arrCoords[11]);
    CarInfo[idx][cLock] = strval(arrCoords[12]);
    printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
    if(CarInfo[idx][cOwned]==0) { gCarLock[idx]=0; }
    idx++;
    }
    }
    return 1;

    Einmal editiert, zuletzt von Hitman <3 ()

  • was hat das jetzt damit zutun ?



    es gibt 84 autos in der datei car.cfg
    wieso dann 10 autos hinzufügen ß???????

  • du hast falsch verstanden Hitman, du solltest die schleife bei 1 beginnen und das CarInfo einfach auf 84 stellen.
    die schleife fing bei dir , bei 302 an, aber in dem Slot war nix gespeichert

    Mfg. BlackFoX_UD_ alias [BFX]Explosion


  • also was muss ich hier einfügen?:


    enum cInfo
    {
    cModel,
    Float:cLocationx,
    Float:cLocationy,
    Float:cLocationz,
    Float:cAngle,
    cColorOne,
    cColorTwo,
    cOwner[MAX_PLAYER_NAME],
    cDescription[MAX_PLAYER_NAME],
    cValue,
    cLicense[MAX_PLAYER_NAME],
    cRegistration,
    cOwned,
    cLock,
    };


    new CarInfo[84][cInfo];
    _______________________________________________________________________________________________________
    und hier:


    public LoadCar()
    {
    new arrCoords[13][64];
    new strFromFile2[256];
    new File: file = fopen("cars.cfg", io_read);
    if (file)
    {
    new idx = 84;
    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]), 999);
    strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 999);
    CarInfo[idx][cValue] = strval(arrCoords[9]);
    strmid(CarInfo[idx][cLicense],arrCoords[10],0,strlen(arrCoords[10]),999);
    CarInfo[idx][cOwned] = strval(arrCoords[11]);
    CarInfo[idx][cLock] = strval(arrCoords[12]);
    printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
    if(CarInfo[idx][cOwned]==0) { gCarLock[idx]=0; }
    idx++;
    }
    }
    return 1;
    ________________________________________________________________________________________________________________________________
    und hier?


    for(new h = 84; h < sizeof(CarInfo); h++)
    {
    CreateVehicle(CarInfo[h][cModel],CarInfo[h][cLocationx],CarInfo[h][cLocationy],CarInfo[h][cLocationz]+1.0,CarInfo[h][cAngle],CarInfo[h][cColorOne],CarInfo[h][cColorTwo],-1);



    ich check nicht soviel von den dingrn ..
    sry wenn ich so aufdringlich bin X(



    und pestaboy .. sry mein bruder hats mir vorgelesen deswegen hab ichs falsch verstanden(lag aufn sofa ^^)


    also nein die autos laden garnicht .. 0 erros nur die autos werden nicht angezeigt die sind garnicht drin


    mfg

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen