1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
Dismiss Notice
Hi Guest, you need a Steam account to register and post on these forums. Login with Steam at the top of the forums to get started!
Dismiss Notice
Hi Guest, do you want to buy HL2RP or another Clockwork schema? Visit the Cloud Sixteen Store to get started!

HL2RP Attachment models selected by gender

Discussion in 'Development' started by Fruitylicious, Feb 12, 2019 at 12:14 PM.

  1. Greetings,
    does anyone know how I would go about making ITEM.attachmentModel selected by gender?
    I have a male and female model attachment model, and instead of making two different items, I believe there must be a way to make it figure out what gender you are and base the ITEM.attachmentModel line off of that.

    I've tried this so far, doesn't seem to work - no errors or anything, just not selecting the right model:
    Code:
    local ITEM = Clockwork.item:New();
    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.isAttachment = true;
    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);
    
    -- 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 the attachment model info should be adjusted.
    function ITEM:AdjustAttachmentModel(player, entity, info)
        if (player:GetGender() == GENDER_FEMALE) then
            info.attachmentModel = "models/bandmodelf.mdl";
        end;
    end;
     
  2. duck

    duck Phant0m Legend

  3. dead flag blues

    dead flag blues "...ours is a world of nuclear giants..." Clockwork Customer Active Member

    Create two separate items and script it to decline the other gender.