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 Items that give flags?

Discussion in 'Development' started by NoahtheBoah36™, Oct 18, 2017.

  1. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Retard Clockwork Customer

    Hey, so I've been working on some custom scripts for my server, and one of the items I'm working on is something to give flags to a player when they use the item. Is there an existing command similar in syntax to player:GiveItem or is it something that's not really there?
     
  2. grafikerror

    grafikerror Clockwork Customer

    What about something like :
    Code:
    Clockwork.player:GiveFlags(player, "The_flag_you_want_to_give")
    In the function ITEM:OnUse(player, itemEntity) of your item ?
     
    • Informative Informative x 1
  3. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Retard Clockwork Customer

    Ah, bless you.
     
    • Like Like x 1
  4. NoahtheBoah36™

    NoahtheBoah36™ Clockwork Retard Clockwork Customer

    Figured I'd show off one of the finished products. This is something I made up for merchants on my server so they have access to the business menu and all items in it upon opening up their kit, which also included other equipment to help start off their characters. It references a lot of items that are also custom coded, but you can get the jist of what I was going for regardless.

    Edit: The line where I included the flags is like the third to last line of the code, just below the long-ass list of items.

    Code:
    -- Created by NoahtheBoah36 AKA Noah Engelmann
    -- Permission to Redistribute/Use/Edit is GRANTED, provided credit is given to the original author.
    
    
    local ITEM = Clockwork.item:New();
    ITEM.name = "kit_merchant";
    ITEM.model = "models/props_c17/SuitCase001a.mdl";
    ITEM.weight = 0;
    ITEM.useText = "Open";
    ITEM.business = false;
    ITEM.category = "Admin Items";
    ITEM.description = "A kit of scripts for a newly created merchant character.";
    
    -- Dropping the item.
    function ITEM:OnDrop(player, position) end;
    
    -- Using the item.
    function ITEM:OnUse(player, itemEntity)
        player:GiveItem(Clockwork.item:CreateInstance("admin_backpack"), true);
        player:GiveItem(Clockwork.item:CreateInstance("weapon_knife"), true);
        player:GiveItem(Clockwork.item:CreateInstance("weapon_crowbar"), true);
        player:GiveItem(Clockwork.item:CreateInstance("sack_of_crowns"), true);
        player:GiveItem(Clockwork.item:CreateInstance("sack_of_crowns"), true);
        player:GiveItem(Clockwork.item:CreateInstance("sack_of_crowns"), true);
        player:GiveItem(Clockwork.item:CreateInstance("orange"), true);
        player:GiveItem(Clockwork.item:CreateInstance("water_bottle"), true);
        player:GiveItem(Clockwork.item:CreateInstance("bandage"), true);
        Clockwork.player:GiveFlags(player, "N")
    end;
    
    ITEM:Register();
    
     
    • Like Like x 1
    • Informative Informative x 1
    Last edited: Oct 19, 2017

Previous Readers (Total: 0)