PDA

View Full Version : Help creating+attaching an object to a vehicle.


Strier
12/06/2013, 07:01 PM
forward mChecker();
public mChecker()
{
for(new i=0;i<MAX_VEHICLES;i++)
{
new vehicle = GetVehicleModel(i);
if(vehicle == 470)
{
if(HasMinigun[ i ] == true)
{
HasMinigun[ i ] = true;
new Float:VehPos[3];
GetVehiclePos(vehicle, VehPos[0],VehPos[1],VehPos[2]);
minigun[ minicount ] = CreateObject(2985, VehPos[0], VehPos[1], VehPos[2], -1.0, 0, 0 , 0.6);
AttachObjectToVehicle( minigun[ minicount ], i, 0.74, 3.37, -0.25, 0.00, 0.00, 89.47 );
minicount++;
}
}
}
return 1;
}

Well, this code ain't attaching the object at all.. what can i do?.

park4bmx
12/06/2013, 10:15 PM
im guessing becouse your variable HasMinigun is checking for the condition true when yet is not!
Also clear up other things

public mChecker()
{
for(new i=0;i<MAX_VEHICLES;i++)
{
if(GetVehicleModel(i) == 470)
{
if(HasMinigun[i] == false)
{
HasMinigun[i] = true;
new Float:VehPos[3];
GetVehiclePos(vehicle, VehPos[0],VehPos[1],VehPos[2]);
minigun[minicount] = CreateObject(2985, VehPos[0], VehPos[1], VehPos[2], -1.0, 0, 0 , 0.6);
AttachObjectToVehicle(minigun[minicount], i, 0.74, 3.37, -0.25, 0.00, 0.00, 89.47 );
minicount++;
}
}
}
return 1;
}