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

How to stop people from disabling collision on their cars

Discussion in 'DarkRP Modding Questions & Help' started by ✪ Zeus, Jun 18, 2017.

  1. ✪ Zeus

    ✪ Zeus New Member

    They use it to go through props and such please tell me how I can make it so they cant do it.
     
  2. Code (Text):
    hook.Add( "CanProperty", "block_collision_property", function( ply, property, ent )
        if ( !ply:IsAdmin() && property == "thenocollisionnamethingiforgot" ) then return false end
    end )
     
    Last edited: Jun 18, 2017
  3. ✪ Zeus

    ✪ Zeus New Member

    Thank you, where do I add this?
     
  4. lua/autorun or lua/autorun/server, its one of those. also, for "thenocollisionthing" make sure its the real name for the collision context thing. I forgot what it was called, for example, if you want remover gone simply put remover in the quotes
     
  5. ✪ Zeus

    ✪ Zeus New Member

    I just blocked the toolgun (for nocollison) will this do the same?
    --- Double Post Merged, Jun 19, 2017 ---
    And they do it with the C menu thing

    Hold c right click on car, disable collisions.
     
  6. Sir Klutch

    Sir Klutch Active Member

    Place in lua/autorun as this is being ran on both server and the client
    Code (Lua):

    local restrictPropertyToGroupsOnly = true -- set to false to disable

    local allowed_property_groups = {
        ["superadmin"] = true, -- set to false to disallow group
        ["admin"] = true, -- set to false to disallow group
    }

    local function DarkRP_PlayahBlockCanProperty(ply, prop, ent)
        if restrictPropertyToGroupsOnly then
            if prop == "collision" and not allowed_property_groups[ply:GetUserGroup()] then
                return false
            end
        elseif prop == "collision" then
            return false
        end
    end

    hook.Add( "CanProperty", "canproperty.blockcollision" DarkRP_PlayahBlockCanProperty)
     
     
    Last edited: Jun 20, 2017
  7. if they can still do c, put the code that I gave you (or klutch's) and place "collision" (i believe thats the correct file. name for the thing) in the quotes.
     
  8. davidk911

    davidk911 Member

    blocking the toolgun will also achieve what you want Quangasaurus is the correct and professional way
     

Share This Page