Loading cars.
#3

I have a problem. I made a debug command to get the owner of the car.

1) The car's owner should be "flashsnake" and the license plate "FLASH".

When I type the CMD, AutoInfo[masin[aOmanik] will be this:

pawn Код:
carowner: flFLASH
pawn Код:
stock LaeAutod()
{
    new query[512];
    format(query, sizeof(query), "SELECT * FROM eraautod");
   
    mysql_query(query);
    mysql_store_result();

    new i = 0;

    while(mysql_retrieve_row())
    {
        new field[64];

        mysql_fetch_field_row(field, "model");
        AutoInfo[i][aModel] = strval(field);
       
        mysql_fetch_field_row(field, "varv1");
        AutoInfo[i][aVarv1] = strval(field);

        mysql_fetch_field_row(field, "varv2");
        AutoInfo[i][aVarv2] = strval(field);

        mysql_fetch_field_row(field, "x");
        AutoInfo[i][aX] = floatstr(field);

        mysql_fetch_field_row(field, "y");
        AutoInfo[i][aY] = floatstr(field);

        mysql_fetch_field_row(field, "z");
        AutoInfo[i][aZ] = floatstr(field);

        mysql_fetch_field_row(field, "a");
        AutoInfo[i][aA] = floatstr(field);

        new masin = CreateVehicle(AutoInfo[i][aModel], AutoInfo[i][aX], AutoInfo[i][aY], AutoInfo[i][aZ]+1.0, AutoInfo[i][aA], AutoInfo[i][aVarv1], AutoInfo[i][aVarv2], -1);
       
        mysql_fetch_field_row(field, "id");
        AutoInfo[masin][aID] = strval(field);
       
        mysql_fetch_field_row(field, "omanik");
        format(AutoInfo[masin][aOmanik],24, "%s", field);
       
        mysql_fetch_field_row(field, "numbrimark");
        format(AutoInfo[masin][aNumbrimark],24, "%s", field);

        SetVehicleNumberPlate(masin, AutoInfo[masin][aNumbrimark]);
        SetVehicleVirtualWorld(masin, 0);
        i++;
    }
    mysql_free_result();
    print("[MYSQL] Autod serverisse laetud!");
    return 1;
}
And debug CMD:

pawn Код:
CMD:debug(playerid, params[])
{
    new aid, string[128];
    aid = kAutoID(playerid);

    format(string, sizeof(string), "carowner: %s", AutoInfo[aid][aOmanik]);
    SendClientMessage(playerid, C_GREY, string);
    return 1;
}
Reply


Messages In This Thread
Loading cars. - by Dan. - 21.05.2012, 12:54
Re: Loading cars. - by coole210 - 21.05.2012, 14:50
Re: Loading cars. - by Dan. - 21.05.2012, 19:13

Forum Jump:


Users browsing this thread: 1 Guest(s)