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!

HL2RP Need help with factions. (SOLVED by Viz)

Discussion in 'Development' started by BetaDesh, Jul 2, 2017.

  1. BetaDesh

    BetaDesh The fuck's a BetaDesh? Clockwork Customer

    Hey so I just need help with a small issue. I need to know how to make it so a certain faction always spawns with a handheld radio. Any help is appreciated.
     
  2. Code:
    function PLUGIN:GetPlayerDefaultInventory(player, character, inventory)
        if (character.faction == FACTION_MPF) then
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("weapon_pistol")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("handheld_radio")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("ammo_ar2")
            );
        elseif (character.faction == FACTION_ADMIN) then
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("weapon_pistol")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("handheld_radio")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("ammo_ar2")
            );
        end;  
    end;
    
    Goes in sv_hooks.lua in your plugin file.
     
  3. BetaDesh

    BetaDesh The fuck's a BetaDesh? Clockwork Customer

    See I tried this and it didn't work. Yes I made sure to change Schema: to PLUGIN: and change the factions to the correct ones.
     
  4. Viz

    Viz Legend Clockwork Customer

    Add the following line to your faction file.
    Code:
    FACTION.startingInv = { handheld_radio = 1 };
     
    • Agree Agree x 1

Previous Readers (Total: 0)