1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Making Entities Physgun-able

Discussion in 'DarkRP Modding Questions & Help' started by bongLord, Dec 28, 2016.

  1. bongLord

    bongLord New Member

    There are some specific entities/props that i want players to be able to physgun (as they can currently only grav gun them) and setting 'Physgun world entities' to true allows them to, players can mess with lawboards and textscreens. I was wondering if there is a way to allow physgunning for these props/entities specifically?
     
  2. Nagisa Momoe

    Nagisa Momoe Member

    Set the owner of the entity to the player by ENT:CPPISetOwner(player)
     
  3. bongLord

    bongLord New Member

    how would i do that?
    --- Double Post Merged, Dec 30, 2016 ---
    --- Double Post Merged, Dec 30, 2016 ---
    Ty garrysmod wikia

    Code (Text):
    -- Made by bongLord

    -- Config              \/ Entity name   \/ Can it be physgunned?
    local entTable = { ["adrug_battery"] = true,
                       ["adrug_fuel"] = true,
                       ["adrug_generator"] = true,
                       ["adrug_heat_lamp"] = true,
                       ["adrug_water"] = true,
                       ["adrug_weed_plant"] = true,
                       ["eml_stove"] = true,
                       ["eml_pot"] = true,
                       ["eml_spot"] = true -- Make sure the last one doesn't have a comma (,)
    }
    -- Don't touch anything below here (if you do I'm not helping you <3)
    hook.Add("playerBoughtCustomEntity", "SetOwnerOnEntBuy", function(ply, enttbl, ent, price)



        if entTable[ent:GetClass()] then        
        ent:CPPISetOwner(ply)
        end

         

    end)
     
     
    Last edited: Dec 30, 2016
  4. Sir Prassa

    Sir Prassa New Member

    bongLord, where you put that code? (Sorry for this revive admins, i need the answer)
     
  5. atmiz47

    atmiz47 New Member

    I can help you. simply place the code inside a new '<ANY_NAME>.lua.' file in lua/autorun/server .
     
  6. NVM IT WORKS thank you man
     
    Last edited: Jun 10, 2019

Share This Page