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 hooks.

Discussion in 'Development' started by BetaDesh, Sep 17, 2017.

  1. BetaDesh

    BetaDesh The fuck's a BetaDesh? Clockwork Customer

    Hey, I just need to know the hook for spawning with a handheld radio, and then respawning with one if a character dies. I looked through the sv_hooks for HL2RP but couldn't figure it out.
     
    • Good Coder Good Coder x 2
  2. Hi, what you're looking for is in sv_hooks.lua at line 220, the GetPlayerDefaultInventory function. The line number may vary depending on the version of cwhl2rp you're using, I personally used version 1.07 (not the latest.)

    Hope this helped :)
     
    • Disagree Disagree x 1
    • Friendly Friendly x 1
  3. Mixed

    Mixed removed Clockwork Customer

    Code:
    function Schema:GetPlayerDefaultInventory(player, character, inventory)
        if (character.faction == FACTION_ADMIN) then
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("handheld_radio")
            );
        elseif (character.faction == FACTION_PC) then
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("handheld_radio")
            );
            end;
        elseif (character.faction == FACTION_OTA) then
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("handheld_radio")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("weapon_pistol")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("ammo_pistol")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("weapon_ar2")
            );
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("ammo_ar2")
            );
        else
            Clockwork.inventory:AddInstance(
                inventory, Clockwork.item:CreateInstance("suitcase")
            );
        end;
    end;
    Make a plugin with sv_hooks.lua if you want to edit these lines of code as you wish.
     

Previous Readers (Total: 0)