09.03.2019, 00:34
Estou um pouco confuso, pois, jб tentei de todas as formas anexar um objeto no veнculo, mas nunca dб certo
PHP Code:
stock Attachment_Refresh(attachmentid)
{
if (attachmentid != -1 && AttachmentData[attachmentid][attachmentExists])
{
if (IsValidDynamicObject(AttachmentData[attachmentid][attachmentObject]))
DestroyDynamicObject(AttachmentData[attachmentid][attachmentObject]);
AttachmentData[attachmentid][attachmentObject] = CreateDynamicObject(
AttachmentData[attachmentid][attachmentModel],
AttachmentData[attachmentid][attachmentPos][0],
AttachmentData[attachmentid][attachmentPos][1],
AttachmentData[attachmentid][attachmentPos][2],
AttachmentData[attachmentid][attachmentRot][0],
AttachmentData[attachmentid][attachmentRot][1],
AttachmentData[attachmentid][attachmentRot][2]
);
SetTimerEx("AttachObjects", 800, false, "d", attachmentid);
return 1;
}
return 0;
}
forward AttachObjects(attachmentid);
public AttachObjects(attachmentid)
{
AttachDynamicObjectToVehicle(
AttachmentData[attachmentid][attachmentObject],
CarData[AttachmentData[attachmentid][attachmentVehicle]][carVehicle],
AttachmentData[attachmentid][attachmentPos][0],
AttachmentData[attachmentid][attachmentPos][1],
AttachmentData[attachmentid][attachmentPos][2],
AttachmentData[attachmentid][attachmentRot][0],
AttachmentData[attachmentid][attachmentRot][1],
AttachmentData[attachmentid][attachmentRot][2]
);
return 1;
}
PHP Code:
stock Car_Spawn(carid)
{
if (carid != -1 && CarData[carid][carExists])
{
if (IsValidVehicle(CarData[carid][carVehicle]))
DestroyVehicle(CarData[carid][carVehicle]);
if (CarData[carid][carColor1] == -1)
CarData[carid][carColor1] = random(127);
if (CarData[carid][carColor2] == -1)
CarData[carid][carColor2] = random(127);
CarData[carid][carVehicle] = CreateVehicle(CarData[carid][carModel], CarData[carid][carPos][0], CarData[carid][carPos][1], CarData[carid][carPos][2], CarData[carid][carPos][3], CarData[carid][carColor1], CarData[carid][carColor2], (CarData[carid][carOwner] != 0) ? (-1) : (1200000));
if (CarData[carid][carVehicle] != INVALID_VEHICLE_ID)
{
for(new i = 0; i < MAX_DYNAMIC_CARS; i++)
{
SetVehicleNumberPlate(CarData[i][carVehicle], CarData[i][carPlate]);
}
if (CarData[carid][carPaintjob] != -1)
{
ChangeVehiclePaintjob(CarData[carid][carVehicle], CarData[carid][carPaintjob]);
}
if (CarData[carid][carLocked])
{
new
engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(CarData[carid][carVehicle], engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(CarData[carid][carVehicle], engine, lights, alarm, 1, bonnet, boot, objective);
}
for (new i = 0; i < 14; i ++)
{
if (CarData[carid][carMods][i]) AddVehicleComponent(CarData[carid][carVehicle], CarData[carid][carMods][i]);
}
ResetVehicle(CarData[carid][carVehicle]);
return 1;
}
}
return 0;
}