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!

Weapon Category Plugin

Discussion in 'Requests' started by The Catalyst, Nov 20, 2018.

  1. The Catalyst

    The Catalyst Clockwork Customer

    It's probably older than hell and long-gone by now, but there used to be a plugin where you could set a weapon's category in it's Lua file, therefore allowing the equipping of more than just a primary and secondary weapon. I checked around this site but I can't quite find it.

    You could literally put this to set a weapon's category if I remember correctly:
    item.Category = "sidearm";

    If this is somehow already a feature in the newest non-beta version of cwhl2rp and I just haven't done it right yet, please let me know. I don't want to use the weight system to determine a "primary" and "secondary" weapon for my own purposes.
  2. _HappyGoLucky

    _HappyGoLucky Clockwork Customer Active Member

    -- Called when a player has been given a weapon.
    function Clockwork:PlayerGivenWeapon(player, class, itemTable)
        if (cwItem:IsWeapon(itemTable) and !itemTable:IsFakeWeapon()) then
            if (!itemTable:IsMeleeWeapon() and !itemTable:IsThrowableWeapon()) then
                if (itemTable("weight") <= 2) then
                    cwPly:CreateGear(player, "Secondary", itemTable);
                    cwPly:CreateGear(player, "Primary", itemTable);
            elseif (itemTable:IsThrowableWeapon()) then
                cwPly:CreateGear(player, "Throwable", itemTable);
                cwPly:CreateGear(player, "Melee", itemTable);
    There isn't a way to set it, but there is this function. In the item you can mark it as a melee weapon but you cannot mark as primary or secondary. Whether or not it is a primary or secondary is based on weight. Below or equal to 2 kg is secondary, anything above is primary.

    If you want to make something to do what you want, psure you just want to do something with that function.
    • Informative Informative x 1

Previous Readers (Total: 0)