Beiträge von Fabi.StaR

    Guten Tag zusammen,


    Ich heiße Fabian K. bin 19 Jahre alt und komme aus Rheinland-Pfalz zu meinen Hobbys gehört mit Freunden Treffen und Programmieren.
    Ich Scripter seid ca. 5 Jahren und suche zurzeit ein Projekt wo ich mitwirken kann.
    Das Team sollte mindestens 17+ sein und eine gewisse reife besitzen.


    Bei Intresse einfach melden.


    ps. Ich weiß diese such anfrage ist kurz also seid nicht so streng. :thumbup:


    #Push 18Uhr

    Ich habs bis jetz so:



    [b]public[/b] OnQueryFinish(ThreadID, ExtraID) {
    [b]new[/b] rows;
    cache_get_row_count(rows);
    [b]switch[/b](ThreadID) {
    [b]case[/b] _SQL_LoadAllCars: {
    [b]if[/b](rows != 0) {
    [b]new[/b] lastid = 0,
    idx = 0;
    [b]while[/b](idx < rows) {
    }
    }
    }
    }
    [b]return[/b] 1;
    }


    will es so ungefähr machen:



    [b]public[/b] Dtdc_LoadAllCars(bool:spawn)
    {
    format(sql,sizeof(sql),"SELECT `Owner`, `SlotId` FROM `playercars` ORDER BY `id`");
    mysql_query_fix(sql);
    mysql_store_result();
    [b]new[/b] strFromFile2[200];
    [b]new[/b] rows = mysql_num_rows();
    [b]if[/b](rows != 0)
    {
    [b]#if[/b] [b]defined[/b] MYSQL_StrickenKid
    [b]new[/b] arrCoords[2][40];
    [b]while[/b] (mysql_fetch_row2(strFromFile2,","))
    {
    Dtdc_split(strFromFile2, arrCoords, ',');
    [b]new[/b] slot = strval(arrCoords[1]);
    [b]new[/b] Name[40];
    strmid(Name, arrCoords[0], 0, strlen(arrCoords[0]), 40);
    [b]new[/b] id = Dtdc_LoadVeh(Name,slot);
    [b]if[/b](id != -1 && spawn == true) {SetTimerEx("Dtdc_SpawnVeh",1000,0,"d",id);}
    }
    mysql_free_result();
    [b]#else[/b]
    [b]new[/b] arrCoords[3][40];
    [b]new[/b] lastid = 0;
    [b]new[/b] idx = 0;
    [b]while[/b] (idx < rows)
    {
    mysql_free_result();
    format(sql,sizeof(sql),"SELECT `Owner`, `SlotId`, `id` FROM `playercars` WHERE `id` > '%d' ORDER BY `id` LIMIT 1",lastid);
    mysql_query_fix(sql);
    mysql_store_result();
    mysql_fetch_row2(strFromFile2,",");
    Dtdc_split(strFromFile2, arrCoords, ',');
    [b]new[/b] slot = strval(arrCoords[1]);
    lastid = strval(arrCoords[2]);
    [b]new[/b] Name[40];
    strmid(Name, arrCoords[0], 0, strlen(arrCoords[0]), 40);
    [b]new[/b] id = Dtdc_LoadVeh(Name,slot);
    [b]if[/b](id != -1 && spawn == true) {SetTimerEx("Dtdc_SpawnVeh",1000,0,"d",id);}
    idx++;
    }
    [b]#endif[/b]
    }
    }

    Setze ich das idx ich hier auf 1 :


    stock OnLoadAllCars() {new Cache:Temp = mysql_query(handle,"SELECT `Owner`, `SlotId` FROM `playervehicles` ORDER BY `ID`"),rows = cache_get_row_count(handle);if(rows != 0){new idx = 1, Name[40], slotid;while (idx < rows) {cache_get_field_content(idx, "Owner", Name, handle, MAX_PLAYER_NAME);slotid = cache_get_field_content_int(idx, "SlotId", handle);LoadPlayerVehicle(Name, slotid);idx++;}}return cache_delete(Temp);}


    wird das zweite Fahrzeug geladen 0o


    EDIT


    Habs jetz so gemacht:



    public OnQueryFinish(Threadid, extraid) {
    switch(Threadid){
    case Thread_OnLoadPlayerVehicles: {
    new id, idx= 0,
    rows = cache_get_row_count(handle);
    while (idx < rows) {
    id = GetFreeCarID();
    pVInfo[id][pV_SQLid] = cache_get_field_content_int(idx, "ID", handle);


    cache_get_field_content(idx, "Owner", pVInfo[id][pV_Owner], handle, MAX_PLAYER_NAME);
    pVInfo[id][pV_SlotID] = cache_get_field_content_int(idx, "SlotId", handle);
    pVInfo[id][pV_ModelID] = cache_get_field_content_int(idx, "ModelID", handle);
    pVInfo[id][pV_Pos][0] = cache_get_field_content_float(idx, "X", handle);
    pVInfo[id][pV_Pos][1] = cache_get_field_content_float(idx, "Y", handle);
    pVInfo[id][pV_Pos][2] = cache_get_field_content_float(idx, "Z", handle);
    pVInfo[id][pV_Pos][3] = cache_get_field_content_float(idx, "A", handle);
    pVInfo[id][pV_Color][0] = cache_get_field_content_int(idx, "Color1", handle);
    pVInfo[id][pV_Color][1] = cache_get_field_content_int(idx, "Color2", handle);


    pVInfo[id][pV_CarID] = CreateVehicle(pVInfo[id][pV_ModelID], pVInfo[id][pV_Pos][0], pVInfo[id][pV_Pos][1], pVInfo[id][pV_Pos][2], pVInfo[id][pV_Pos][3], pVInfo[id][pV_Color][0], pVInfo[id][pV_Color][1], -1);
    printf("VehID: %i | Owner: %s | SlotID: %i", pVInfo[id][pV_CarID], pVInfo[id][pV_Owner], pVInfo[id][pV_SlotID]);
    idx++;
    }
    return 1;
    }
    }
    return 1;
    }

    Guten Morgen,


    Beim laden des Fahrzeuges wird nur das erste fahrzeug in der Datenbank geladen und ich kann den fehler nicht finden.


    Hier mein Code:



    stock OnLoadAllCars() {
    new Cache:Temp = mysql_query(handle,"SELECT `Owner`, `SlotId` FROM `playervehicles` ORDER BY `ID`");
    if(cache_get_row_count(handle) != 0)
    {
    new idx = 0, lastid = 0, sql[258];
    format(sql,sizeof(sql),"SELECT `Owner`, `SlotId`, `ID` FROM `playervehicles` WHERE `ID` > '%d' ORDER BY `ID` LIMIT 1",lastid);
    new Cache:Temp1 = mysql_query(handle, sql);
    new rows = cache_get_row_count(handle);
    while (idx < rows) {
    new Name[40];
    cache_get_field_content(idx, "Owner", Name, handle, MAX_PLAYER_NAME);
    new slotid = cache_get_field_content_int(idx, "SlotId", handle);
    lastid = cache_get_field_content_int(idx, "ID", handle);
    LoadPlayerVehicle(Name, slotid);
    idx++;
    }
    cache_delete(Temp1);
    }
    cache_delete(Temp);
    }


    stock LoadPlayerVehicle(PlayerName[], Slot) {
    printf("Owner: %s | Slot: %i", PlayerName,Slot);
    new sql[258];
    format(sql,sizeof(sql),"SELECT * FROM `playervehicles` WHERE `Owner` = '%s' AND `SlotId` = '%d' ORDER BY `ID` DESC LIMIT 1",PlayerName,Slot);
    new Cache:Temp = mysql_query(handle,sql),
    rows = cache_get_row_count(handle),
    id, idx = 0;
    while (idx < rows) {
    for(new i= 0; i < MAX_VEHICLES; i++) {
    if(pVInfo[i][pV_CarID] < 1) {
    id = i;
    break;
    }
    }
    pVInfo[idx][pV_SQLid] = cache_get_field_content_int(idx, "ID", handle);
    cache_get_field_content(idx, "Owner", pVInfo[id][pV_Owner], handle, MAX_PLAYER_NAME);
    pVInfo[id][pV_SlotID] = cache_get_field_content_int(idx, "SlotId", handle);
    pVInfo[id][pV_ModelID] = cache_get_field_content_int(idx, "ModelID", handle);
    pVInfo[id][pV_Pos][0] = cache_get_field_content_float(idx, "X", handle);
    pVInfo[id][pV_Pos][1] = cache_get_field_content_float(idx, "Y", handle);
    pVInfo[id][pV_Pos][2] = cache_get_field_content_float(idx, "Z", handle);
    pVInfo[id][pV_Pos][3] = cache_get_field_content_float(idx, "A", handle);
    pVInfo[id][pV_Color][0] = cache_get_field_content_int(idx, "Color1", handle);
    pVInfo[id][pV_Color][1] = cache_get_field_content_int(idx, "Color2", handle);
    pVInfo[id][pV_CarID] = CreateVehicle(pVInfo[id][pV_ModelID], pVInfo[id][pV_Pos][0], pVInfo[id][pV_Pos][1], pVInfo[id][pV_Pos][2], pVInfo[id][pV_Pos][3], pVInfo[id][pV_Color][0], pVInfo[id][pV_Color][1], -1);
    printf("VehID: %i | Owner: %s | SlotID: %i", pVInfo[id][pV_CarID], pVInfo[id][pV_Owner], pVInfo[id][pV_SlotID]);
    idx++;
    }
    cache_delete(Temp);
    return 1;
    }


    Bitte um hilfe.