1. This forum is ARCHIVED! Visit the new Cloud Sixteen forums, codename Eden, at https://eden.cloudsixteen.com. These forums will remain archived for a few months before being closed down, so try to encourage plugin developers to begin moving their content across to the new forums.
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!

Other Creating a new business category

Discussion in 'Development' started by Darklord, May 16, 2016.

  1. Darklord

    Darklord Clockwork Customer

    Hi there folks i've been trying to create a new bussnies category for "clothing" and i couldnt figure out a way to do it so far so i had to add them to the "general goods" section and it made the price go to 16k+ and i really need a way to create a new business category i would really appreciate it if you guys could help :)
     
    • Good Coder Good Coder x 1
  2. Sly

    Sly Some kinda Sly? Legend Clockwork Customer

    If I remember right, you just need to set the category within the item file to the name of what you want it to be in the business menu.
    Basically:
    ITEM.category = "Clothing";


    EDIT: Also, on the note that you said it costs 16k for items; If you are using the salesman, make sure you have the price multiplier set lower. This will make sure it doesn't escalate the price to outrageous amounts.
     
  3. Darklord

    Darklord Clockwork Customer

    the "general goods" thing at business category bumped up to 16k when i added the clothes
     
    • Good Coder Good Coder x 1
  4. Darklord

    Darklord Clockwork Customer

    Code:
    local ITEM = Clockwork.item:New();
    ITEM.name = "Tattered Gloves";
    ITEM.model = "models/tnb/items/gloves.mdl";
    ITEM.weight = 1;
    ITEM.useText = "Wear Gloves";
    ITEM.category = "Clothing";
    ITEM.description = "A pair of grey mittens, the fingers have been removed.";
    ITEM.customFunctions = {"Remove"};
    ITEM.access = "1";
    ITEM.cost = 180;
    ITEM.business = true;
    local bodyGroup = 3;
    -- Called when a player drops the item.
    function ITEM:OnDrop(player, position)
                            local target = player
                            local targetBodyGroups = target:GetCharacterData("BodyGroups") or {};
                            local bodyGroupState = 0;
                            local model = target:GetModel();
                  
                            if( bodyGroup < target:GetNumBodyGroups() )then
                                    targetBodyGroups[model] = targetBodyGroups[model] or {};
                          
                                    if( bodyGroupState == 0 )then
                                            targetBodyGroups[model][tostring(bodyGroup)] = nil;
                                    else
                                            targetBodyGroups[model][tostring(bodyGroup)] = bodyGroupState;
                                    end;
                          
                                    target:SetBodygroup(bodyGroup, bodyGroupState);
                          
                                    target:SetCharacterData("BodyGroups", targetBodyGroups);
                                  
                            end;
    return true
                  
    end;
    if (CLIENT) then
        function ITEM:GetClientSideInfo()
            if (!self:IsInstance()) then return; end;
          
            if (Clockwork.player:IsWearingItem(self)) then
                return "Is Wearing: Yes";
            else
                return "Is Wearing: No";
            end;
        end;
    end;
    -- Called when a player uses the item.
    function ITEM:OnUse(player, itemEntity)
            if (player:Alive() and !player:IsRagdolled()) then
                    if (!self.CanPlayerWear or self:CanPlayerWear(player, itemEntity) != false) then
                  
                    local target = player
                    local targetBodyGroups = target:GetCharacterData("BodyGroups") or {};
                    local bodyGroupState = 1;
                    local model = target:GetModel();
                  
                    if( bodyGroup < target:GetNumBodyGroups() )then
                            targetBodyGroups[model] = targetBodyGroups[model] or {};
                          
                            if( bodyGroupState == 0 )then
                                    targetBodyGroups[model][tostring(bodyGroup)] = nil;
                            else
                                    targetBodyGroups[model][tostring(bodyGroup)] = bodyGroupState;
                            end;
                          
                            target:SetBodygroup(bodyGroup, bodyGroupState);
                          
                            target:SetCharacterData("BodyGroups", targetBodyGroups);
                  
                            return true;
                            end;
                    end;
            end;
    end;
    if (SERVER) then
            function ITEM:OnCustomFunction(player, name)
                    if (name == "Remove") then
                  
                            local target = player
                            local targetBodyGroups = target:GetCharacterData("BodyGroups") or {};
                            local bodyGroupState = 0;
                            local model = target:GetModel();
                  
                            if( bodyGroup < target:GetNumBodyGroups() )then
                                    targetBodyGroups[model] = targetBodyGroups[model] or {};
                          
                                    if( bodyGroupState == 0 )then
                                            targetBodyGroups[model][tostring(bodyGroup)] = nil;
                                    else
                                            targetBodyGroups[model][tostring(bodyGroup)] = bodyGroupState;
                                    end;
                          
                                    target:SetBodygroup(bodyGroup, bodyGroupState);
                          
                                    target:SetCharacterData("BodyGroups", targetBodyGroups);
                                  
                            end;
                                                  
    end;
    end;
    end;
    ITEM:Register();
    the item i wanna create the business is "hl2ts2" and its alredy at category business when i added it just goed to general goods and made it 16 k
     
    • Good Coder Good Coder x 1

Previous Readers (Total: 0)