25.11.2016, 08:43
i have a vehicle system but the problem is it creates different vehicle ids
here is the code
when i type /dl it shows different vehicle id and in vehicle menu it is different
how to fix it
here is the code
PHP код:
new carid = vehicleid;
new Str[250], vTotal, vehID, vehModel, Float:vehX, Float:vehY, Float:vehZ, Float:vehA, vehC1, vehC2, vehOwnedBy[24], ForSale, DefaultPrice, Price, Locked;
mysql_reconnect();
new carmod[17];
new query[512];
format(query,sizeof(query),"SELECT * FROM `pvehicles` WHERE `VehicleID` = '%d' LIMIT 1", vehicleid);
mysql_query(query);
mysql_store_result();
vTotal = mysql_num_rows();
if(vTotal > 0)
{
mysql_fetch_row(Str);
DestroyVehicle(PVInfo[carid][vpVehicleSpawned]);
//Delete3DTextLabel(PVInfo[carid][vpVehicleText]);
sscanf(Str, "p<|>dds[24]ffffddddddddddddddddddddddd",
vehID,vehModel,vehOwnedBy,vehX,vehY,vehZ,vehA,vehC1,vehC2,ForSale,DefaultPrice,Price,Locked,carmod[0],carmod[1],carmod[2],carmod[3],carmod[4],carmod[5],carmod[6],carmod[7],carmod[8],carmod[9],carmod[10],carmod[11],carmod[12],carmod[13],carmod[14],carmod[15],carmod[16]);
carid=vehID;
new carid2 = CreateVehicle(vehModel, vehX, vehY, vehZ, vehA, vehC1, vehC2, (30 * 60));
PVInfo[carid][vpID] = vehID;
PVInfo[carid][vpPosX] = vehX;
PVInfo[carid][vpPosY] = vehY;
PVInfo[carid][vpPosZ] = vehZ;
PVInfo[carid][vpPosA] = vehA;
PVInfo[carid][vpColor1] = vehC1;
PVInfo[carid][vpColor2] = vehC2;
PVInfo[carid][vpModel] = vehModel;
PVInfo[carid][vpForSale] = ForSale;
PVInfo[carid][vpDefaultPrice] = DefaultPrice;
PVInfo[carid][vpPrice] = Price;
PVInfo[carid][vpLocked] = Locked;
PVInfo[carid2][mod1] = carmod[0];
PVInfo[carid2][mod2] = carmod[1];
PVInfo[carid2][mod3] = carmod[2];
PVInfo[carid2][mod4] = carmod[3];
PVInfo[carid2][mod5] = carmod[4];
PVInfo[carid2][mod6] = carmod[5];
PVInfo[carid2][mod7] = carmod[6];
PVInfo[carid2][mod8] = carmod[7];
PVInfo[carid2][mod9] = carmod[8];
PVInfo[carid2][mod10] = carmod[9];
PVInfo[carid2][mod11] = carmod[10];
PVInfo[carid2][mod12] = carmod[11];
PVInfo[carid2][mod13] = carmod[12];
PVInfo[carid2][mod14] = carmod[13];
PVInfo[carid2][mod15] = carmod[14];
PVInfo[carid2][mod16] = carmod[15];
PVInfo[carid2][mod17] = carmod[16];
if(ForSale == 1)
{
format(Str, sizeof(Str), "%s for sale!\nPrice: $%d (Seller: %s)\n/dealership to purchase!", GetVehicleFriendlyName(carid2),Price, vehOwnedBy);
PVInfo[carid][vpVehicleText] = Create3DTextLabel(Str, 0xFF8400FF, vehX, vehY, vehZ, 50.0, 0, 1);
}
else
{
format(Str, sizeof(Str), "%s\nOwner: %s", GetVehicleFriendlyName(carid2),vehOwnedBy);
PVInfo[carid][vpVehicleText] = Create3DTextLabel(Str, 0xFF8400FF, vehX, vehY, vehZ, 50.0, 0, 1);
}
Attach3DTextLabelToVehicle(PVInfo[carid][vpVehicleText], carid2, 0.0, 0.0, 0.0);
new string[64];
format(string,sizeof(string),"%s",vehOwnedBy);
strmid(PVInfo[carid][vpOwnedBy], string, 0, strlen(string), 128);
PVInfo[carid][vpVehicleSpawned] = carid2;
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid2,engine,lights,alarm,doors,bonnet,boot,objective);
if(Locked == 1) { SetVehicleParamsEx(carid2,engine,lights,alarm,1,bonnet,boot,objective); }
else if(Locked == 0) { SetVehicleParamsEx(carid2,engine,lights,alarm,0,bonnet,boot,objective); }
}
mysql_free_result();
}
how to fix it