26.07.2016, 12:37
My script has a problem
if veh id is 14 it will display the trunk object even its a bike
if veh id is 14 it will display the trunk object even its a bike
PHP код:
stock LoadCarIDObjects(key) {
if(!IsNotAEngineCar(key))
{
if(!IsHelmetCar(key) && !IsBike(key))
{
new item[6], Float:x, Float:y, Float:z, count = 0;
if(VehicleInfo[key][vType] == VEHICLE_PERSONAL && IsTrunkCar(GetVehicleModel(key)))
{
GetVehicleModelInfo(GetVehicleModel(key), 6, x, y, z);
item[1]=VehicleInfo[key][vInvID][1], item[2]=VehicleInfo[key][vInvID][2];
item[3]=VehicleInfo[key][vInvID][3], item[4]=VehicleInfo[key][vInvID][4];
item[5]=VehicleInfo[key][vInvID][5];
forEx(new i = 1; i < 6; i++)
{
if(VehicleInfo[key][cObject][i] > 0)
{
if(IsValidDynamicObject(VehicleInfo[key][cObject][i])) { DestroyDynamicObject(VehicleInfo[key][cObject][i]); }
VehicleInfo[key][cObject][i] = 0;
}
if(item[i] > 0)
{
if(TrunkObject(item[i], 1))
{
count++;
}
}
}
if(count > 0)
{
forEx(new i = 1; i < 6; i++)
{
if(item[i] > 0)
{
if(TrunkObject(item[i], 1))
{
VehicleInfo[key][cObject][i]=CreateDynamicObject(TrunkObject(item[i], 2), x, y, z, 0.0, 0.0, 0.0, GetVehicleVirtualWorld(key));
new Float:offset = 0.0, Float:offset2 = 0.0;
switch(count)
{
case 1:
{
switch(i)
{
case 1: { offset=1.0, offset2=TrunkOffset(GetVehicleModel(key), 1); }
}
}
case 2:
{
switch(i)
{
case 1: { offset=1.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 2: { offset=0.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
}
}
case 3:
{
switch(i)
{
case 1: { offset=1.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 2: { offset=0.9, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 3: { offset=0.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
}
}
case 4:
{
switch(i)
{
case 1: { offset=1.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 2: { offset=1.0, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 3: { offset=0.7, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 4: { offset=0.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
}
}
case 5:
{
switch(i)
{
case 1: { offset=1.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 2: { offset=1.0, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 3: { offset=0.9, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 4: { offset=0.7, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 5: { offset=0.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
}
}
case 6:
{
switch(i)
{
case 1: { offset=1.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 2: { offset=1.2, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 3: { offset=1.0, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 4: { offset=0.8, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 5: { offset=0.6, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 6: { offset=0.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
}
}
default:
{
switch(i)
{
case 1: { offset=1.5, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 2: { offset=1.4, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 3: { offset=1.2, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 4: { offset=1.0, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 5: { offset=0.8, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 6: { offset=0.6, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
case 7: { offset=0.4, offset2=TrunkOffset(GetVehicleModel(key), 1); }
case 8: { offset=0.2, offset2=TrunkOffset(GetVehicleModel(key), 1)-0.1; }
}
}
}
AttachDynamicObjectToVehicle(VehicleInfo[key][cObject][i], key, x-offset, y-offset2, z+TrunkOffset(GetVehicleModel(key), 2), 0.0+TrunkObject(item[i], 3), 0.0, 0.0+90.0);
}
}
}
}
}
}
}
return true;
}