View Single Post
Old 31/01/2020, 02:26 PM   #2
SiaReyes
Gangsta
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 619
Reputation: 57
Default Re: MySQL load vehicles issue

pawn Code:
forward LoadVehicles();
public LoadVehicles()
{
    new rows, fields, count, data[24], id;
    cache_get_data(rows, fields);
    for(new i = 0; i < rows; i++)
    {

            id = cache_get_field_content_int(i, "ID");
            CarInfo[id][cID] = id;

            cache_get_field_content(i, "CarID", data);
            CarInfo[id][cCarID] = strval(data);
            cache_get_field_content(i, "Owned", data);
            CarInfo[id][cOwned] = strval(data);
            cache_get_field_content(i, "Owner", data);
            strmid(CarInfo[id][cOwner], data, 0, strlen(data), 64);
            cache_get_field_content(i, "Model", data);
            CarInfo[id][cModel] = strval(data);
            cache_get_field_content(i, "Location_X", data); CarInfo[id][cLocationx] = floatstr(data);
            cache_get_field_content(i, "Location_Y", data); CarInfo[id][cLocationy] = floatstr(data);
            cache_get_field_content(i, "Location_Z", data); CarInfo[id][cLocationz] = floatstr(data);

            cache_get_field_content(i, "Angle", data);
            CarInfo[id][cAngle] = floatstr(data);
            cache_get_field_content(i, "Color_1", data);
            CarInfo[id][cColorOne] = strval(data);
            cache_get_field_content(i, "Color_2", data);
            CarInfo[id][cColorTwo] = strval(data);
            cache_get_field_content(i, "VirtualWorld", data);
            CarInfo[id][cVirWorld] = strval(data);

            if(CarInfo[id][cOwned] == 0 || CarInfo[id][cModel] == 0)
            {
                CarInfo[id][cCarID] = NBC_AddStaticVehicleEx(510, -804.5384, 3791.8506, 39.4313+j, CarInfo[id][cAngle], CarInfo[id][cColorOne], CarInfo[id][cColorTwo], 60000, 0);
            }
            else
            {
                CarInfo[id][cCarID] = NBC_AddStaticVehicleEx(CarInfo[id][cModel], CarInfo[id][cLocationx], CarInfo[id][cLocationy], CarInfo[id][cLocationz]+1.0, CarInfo[id][cAngle], CarInfo[id][cColorOne], CarInfo[id][cColorTwo], 60000, 0);
            }
            count++;
    }
    return 1;
}

Try this.
SiaReyes is offline   Reply With Quote