Loading only the rows from the database which is in it
#7

Even if I tell you EXACTLY what to do, you're unable to do it ...

pawn Код:
// Loop all personal vehicles
stock LoopVehicles()
{
    savestring[200], Cars[128];
    new vid; // idx
   
    mysql_query("SELECT * FROM Vehicles");
    mysql_store_result();

    while(mysql_fetch_row_format(query, "|"))
    {
        mysql_fetch_field_row(savestring, "vID"); VehInfo[vid][vID] = strval(savestring);
        format(VehInfo[vid][Owner], MAX_PLAYER_NAME, "%s", mysql_fetch_field_row(savestring, "Owner"));
        //mysql_fetch_field_row(savestring, "Owner"); format(VehInfo[vid][Owner], 24, "%s",savestring);
        mysql_fetch_field_row(savestring, "SpawnX"); VehInfo[vid][SpawnX] = strval(savestring);
        mysql_fetch_field_row(savestring, "SpawnY"); VehInfo[vid][SpawnY] = strval(savestring);
        mysql_fetch_field_row(savestring, "SpawnZ"); VehInfo[vid][SpawnZ] = strval(savestring);
        mysql_fetch_field_row(savestring, "SpawnAngle"); VehInfo[vid][SpawnAngle] = strval(savestring);
        mysql_fetch_field_row(savestring, "Model"); VehInfo[vid][Model] = strval(savestring);
        mysql_fetch_field_row(savestring, "BelongsTo"); VehInfo[vid][BelongsToHouse] = strval(savestring);
        mysql_fetch_field_row(savestring, "Price"); VehInfo[vid][Price] = strval(savestring);
        mysql_fetch_field_row(savestring, "SellPrice"); VehInfo[vid][SellPrice] = strval(savestring);
        mysql_fetch_field_row(savestring, "color1"); VehInfo[vid][color1] = strval(savestring);
        mysql_fetch_field_row(savestring, "color2"); VehInfo[vid][color2] = strval(savestring);

        CreateVehicle(VehInfo[vid][Model], VehInfo[vid][SpawnX], VehInfo[vid][SpawnY], VehInfo[vid][SpawnZ], VehInfo[vid][SpawnAngle], VehInfo[vid][color1], VehInfo[vid][color2], 200);
        format(Cars, sizeof(Cars), "{ff6600}%s owner:\n%s",GetVehicleFriendlyName(vid), VehInfo[vid][Owner]);
        VehLabel[vid] = Create3DTextLabel(Cars, 0xFFFFFFFF, 0.0, 0.0, 0.0, 50.0, -1, 0);
        Attach3DTextLabelToVehicle(VehLabel[vid], vid, 0.0, 0.0, 0.4);
        vid++; // HERE
    }
   
    mysql_free_result();
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)