Skip to content

Instantly share code, notes, and snippets.

@sanny-io
Created February 12, 2019 19:41
Show Gist options
  • Select an option

  • Save sanny-io/5194686e1e776150adce01ce58298a83 to your computer and use it in GitHub Desktop.

Select an option

Save sanny-io/5194686e1e776150adce01ce58298a83 to your computer and use it in GitHub Desktop.
Accessory
local ITEM = Clockwork.item:New("accessory_base");
ITEM.name = "Test attachment";
ITEM.cost = 0;
ITEM.model = "models/bandmodelm.mdl";
ITEM.weight = 0;
ITEM.category = "Bands";
ITEM.uniqueID = "bandm";
ITEM.business = false;
ITEM.examineOveride = true;
ITEM.description = "A band description.";
ITEM.attachmentModel = "models/bandmodelm.mdl";
ITEM.attachmentBone = "ValveBiped.Bip01_R_UpperArm";
ITEM.attachmentOffsetAngles = Angle(male offset angle goes here);
ITEM.attachmentOffsetVector = Vector(male offset vector goes here);
ITEM:AddData("Gender", GENDER_MALE, true);
ITEM:AddQueryProxy("attachmentModel", function(itemTable)
if (itemTable:GetData("Gender") == GENDER_FEMALE) then
return "models/bandmodelf.mdl";
end;
return "models/bandmodelm.mdl";
end);
-- Called when the attachment offset info should be adjusted.
function ITEM:AdjustAttachmentOffsetInfo(player, entity, info)
if (player:GetGender() == GENDER_FEMALE) then
info.offsetAngle = Angle(342, 82.42, 146.84);
info.offsetVector = Vector(0.663, -0.414, 7.18);
end;
end;
-- Called when a player wears the accessory.
function ITEM:OnWearAccessory(player, isWearing)
if (isWearing) then
self:SetData("Gender", player:GetGender());
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment