1. Check out the Store if you're looking to Buy HL2RP or other schemas for your server. You can click Buy Schemas on the very top navigation bar to visit the store.
  2. Use the Plugin Center to easily subscribe to and auto-install Clockwork plugins to your server, or submit and share plugins you have developed.
  3. Having trouble setting up or developing with Clockwork? Check out the Wiki or post in the Support Forum for advice from fellow users.
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 Combine Locks Fix

Discussion in 'Development' started by Vortix, Aug 8, 2015.

  1. Vortix

    Vortix Active Member

    Here's a fix for Combine Locks not positioning correctly in certain maps (namely industrial 17): http://www.mediafire.com/download/v5eqxgmyrlwrwh4
    It overrides the Schema's LoadCombineLocks function so you'll get a message warning you of that when you load up the server.
    • Winner Winner x 2
  2. user2g

    user2g A ghost that roams gmod. Clockwork Customer Active Member

    I'll give it a shot.

    Edit:Nope not workin at all.
    Last edited: Aug 9, 2015
  3. No, doesn't work.
    EDIT: Does this need to go in the Clockwork Plugin file or HL2RP? I put it in the latter one.
  4. Vortix

    Vortix Active Member

    Put it in HL2RP. Are you certain? Any error? Does a message pop up saying that the hook was overridden? It works perfectly on my test server.

    If you haven't already, try replacing your old lock with a new one and waiting for the save interval to pass before restarting.
    Last edited: Aug 9, 2015
  5. Hmm... We added the locks again and this time it seems to work very well. Thanks a bunch Vortix :)
    • Like Like x 1
  6. user2g

    user2g A ghost that roams gmod. Clockwork Customer Active Member

    Eh.. i'll give it back another shot.
    • Like Like x 3
  7. this isn't working for me......
  8. karl-police

    karl-police Hotrod turret Clockwork Customer Active Member

    The issue is at cwhl2rp > plugin > sv_hooks and sv_schema
    Thinking that the issue is may at sv_schema.lua

    Gr4Ss did said the issue is the function FindInSphere.

    <14:01:13> "Gr4Ss": no clue, I don't have the default schema anymore and I fixed it a long time ago for lp
    <14:01:33> "Gr4Ss": the problem is in the fact that it doesn't always reattaches itself to the correct entity
    <14:02:08> "Gr4Ss": it just does a FindInSphere and picks the first one
    <14:02:18> "Gr4Ss": instead of looking for the closests one
    <14:31:52> "Gr4Ss": that code you found is the right bit btw, problem is the FindInSphere() doesn't return entities sorted on distance from the center

    The code
    -- A function to load the Combine locks.
    function Schema:LoadCombineLocks()
        local combineLocks = Clockwork.kernel:RestoreSchemaData( "plugins/locks/"..game.GetMap() );
        for k, v in pairs(combineLocks) do
            local entity = ents.FindInSphere(v.doorPosition, 16)[1];
            if (IsValid(entity)) then
                local combineLock = self:ApplyCombineLock(entity);
                if (combineLock) then
                    Clockwork.player:GivePropertyOffline(v.key, v.uniqueID, entity);
                    if (!v.locked) then
    Same issue to Union Locks

    Last edited: Apr 10, 2016
  9. To elaborate:
    local entity = ents.FindInSphere(v.doorPosition, 16)[1];
    ^ is not always the correct entity because the entities returned by FindInSphere aren't sorted on distance to the center of the sphere.
    So instead of picking the first entity returned you should just for-loop the table FindInSphere returns and find the one with the smallest distance to the original position and you can also check that entity has the correct class.

    At least that's how I fixed it on LP, you may also be able to fix it using MapCreationID().
    • Winner Winner x 1

Previous Readers (Total: 0)