29.06.2014, 07:28
So, the thing is in database it says that vehicle is owned by "Sale", but the strcmp isn't detecting it, what's the problem here?
pawn Код:
new DBResult:re = db_query(BFU, "SELECT * FROM vehicles"), vid;
if(db_num_rows(re))
{
for(new i = 0; i < db_num_rows(re); i++)
{
new Field[32];
db_get_field_assoc(re, "id", Field, 9); vid = strval(Field);
db_get_field_assoc(re, "owner", Field, 21); format(VehicleInfo[vid][vOwner], 21, "%s", Field);
db_get_field_assoc(re, "posx", Field, 20); VehicleInfo[vid][vPosX] = floatstr(Field);
db_get_field_assoc(re, "posy", Field, 20); VehicleInfo[vid][vPosY] = floatstr(Field);
db_get_field_assoc(re, "posz", Field, 20); VehicleInfo[vid][vPosZ] = floatstr(Field);
db_get_field_assoc(re, "angle", Field, 20); VehicleInfo[vid][Angle] = floatstr(Field);
db_get_field_assoc(re, "model", Field, 20); VehicleInfo[vid][Model] = strval(Field);
db_get_field_assoc(re, "color1", Field, 4); VehicleInfo[vid][Color1] = strval(Field);
db_get_field_assoc(re, "color2", Field, 4); VehicleInfo[vid][Color2] = strval(Field);
db_get_field_assoc(re, "cost", Field, 8); VehicleInfo[vid][vCost] = strval(Field);
AddStaticVehicleEx(VehicleInfo[vid][Model], VehicleInfo[vid][vPosX], VehicleInfo[vid][vPosY], VehicleInfo[vid][vPosZ], VehicleInfo[vid][Angle], VehicleInfo[vid][Color1], VehicleInfo[vid][Color2], 300);
printf(">>>>>>>>>>>> vehicle %d reached 1", vid);
if(strcmp(VehicleInfo[vid][vOwner], "Sale") == 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective);
Sale[vid] = Create3DTextLabel("Vehicle info loading...", 0x0088FFFF, VehicleInfo[vid][vPosX], VehicleInfo[vid][vPosY], VehicleInfo[vid][vPosZ], 20.0, 0, 0);
new VLInfo[85];
format(VLInfo, sizeof(VLInfo), "%s(%d)\nCost: %d$", VehName[vid-400], vid, VehicleInfo[vid][vCost]);
Update3DTextLabelText(Sale[vid], 0x0088FFFF, VLInfo), VLInfo = "\0";
Attach3DTextLabelToVehicle(Sale[vid], vid, 0.0, 0.0, 2.0);
printf(">>>>>>>>>>>> vehicle %d reached 2", vid);
}
db_next_row(re);
}
}
db_free_result(re);