Evocity Cleanup + Elevator fix (One Lua Script)

(This seems to be the right place to post this)

I made this script a while ago, and thought I might as well release it, it’s MAINLY for RP since it cleans up props etc, but the elevator plugin I wrote might be useful elsewhere.

http://cloud.steampowered.com/ugc/632989400354811631/FD51E35E327787EBF8227D6D59976ECC12923D4C/

As you can see, it adds a button for each floor, the elevator will now go directly from 2nd floor to 1st, etc, and you can optionally choose to increase the speed of the elevator.

As far as the code goes, I haven’t optimised it at all, however it is run once, and that’s it, so I’m not gonna really bother.


-- Run this code once all the entites have been created:
hook.Add("InitPostEntity", "LiftPatcher", function ()
    -- Make sure we are on evocity:
    if string.lower(game.GetMap()) == "rp_evocity_v2d" then
        --[[
                               SETTINGS
        ]]
        -- These two settings are for the main lift with 4 floors:
        local patchlift = true              -- Do you want to add floor management?
        local newliftspeed = 200            -- If so, how fast do you want it to move? (Default 100) (It will miss the floors if you set it too high, simply TEST IT)

        -- Lift Speeds:
        local othernewliftspeed = 400       -- The speed of the lift in the building with forcefields (Default 100)
        local underliftspeed = 400          -- The speed of the lift that goes underground (Default 100)
        -- Note: @ 400 it wont perfectly align with the floors, but it still works, and is FAST!

        -- Prop cleanup:
        local removeloseprops = true        -- Remove the lose physics objects laying around the map?
        local removewhalespawner = true     -- Remove the whale spawner?

        -- Focefields that break RP:
        local RemoveForceFields = true      -- Remove the forcefields from that other building with a lift
        local RemoveJailForceField = true   -- Remove the forcefield from the jail?
        local RemoveLabForceFields = true   -- Remove the forcefields from the lab?

        -- Door Locking:
        local LockPoliceStuff = true        -- Lock the nexas doors?

        -- Remove breakables:
        local RemoveBreakableStuff = true   -- Remove the breakable doors and stuff from around the map

        -- Remove the Incinerator
        local RemoveIncinerator = true      -- Remove the Incinerator (It can be used for mass griefing if you know how)

        -- Move the teleporters up? This is useful for servers were players collide,
        -- it HELPS to stop them from getting stuck inside eachother
        local ShiftTeleporters = true





        --[[
                   DONT TOUCH ANYTHING BELOW HERE
        ]]

        for k,ent in pairs(ents.GetAll()) do
            -- Remove all the useless props:
            if removeloseprops then
                if(ent:GetClass() == "prop_physics_multiplayer") then
                    ent:Remove()
                end
                if(ent:GetClass() == "prop_physics") then
                    ent:Remove()
                end
            end

            -- Remove the whale + tyre spawners:
            if removewhalespawner then
                if(ent:GetName() == "whaletemp") then
                    ent:Remove()
                end
                if(ent:GetName() == "dingotemp") then
                    ent:Remove()
                end
                -- Remove the switch that spawns whales + tyres:
                if(ent:GetPos() == Vector(3586.38,-6770.49,185.64)) then
                    ent:Remove()
                end
            end

            if RemoveForceFields then
                -- Remove the yukuza door 1:
                if(ent:GetPos() == Vector(-5379.99,-9377,129.96)) then
                    ent:Remove()
                end

                -- Remove the yukuza door 2:
                if(ent:GetPos() == Vector(-5379.99,-9193,129.96)) then
                    ent:Remove()
                end

                -- Remove the yukuza button 1:
                if(ent:GetPos() == Vector(-5204.61,-9421.51,109.47)) then
                    ent:Remove()
                end

                -- Remove the yukuza button 2:
                if(ent:GetPos() == Vector(-5191.61,-9421.51,109.47)) then
                    ent:Remove()
                end
            end

            if RemoveJailForceField then
                -- Remove the button 1 from the nexas jail:
                if(ent:GetPos() == Vector(-6761.5,-9456,890)) then
                    ent:Remove()
                end

                -- Remove the button 2 from the nexas jail:
                if(ent:GetPos() == Vector(-6761.5,-9450,890)) then
                    ent:Remove()
                end

                -- Remove the forcefield in the nexas jail:
                if(ent:GetPos() == Vector(-6768,-9501,900)) then
                    ent:Remove()
                end
            end

            if LockPoliceStuff then
                --Lock the nexas Doors + Garage:
                if(ent:GetPos() == Vector(-6792,-8653,136)) then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetPos() == Vector(-7048,-8653,136)) then
                    ent:Fire("lock", "", 0) -- Right
                end
                if(ent:GetPos() == Vector(-7676,-8685,168)) then
                    ent:Fire("lock", "", 0) -- Garage
                end

                --Lock the one cell door used in the nexas:
                if(ent:GetName() == "Cell1") then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetName() == "Cell2") then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetName() == "Cell3") then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetName() == "Cell4") then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetName() == "Cell5") then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetName() == "Cell6") then
                    ent:Fire("lock", "", 0) -- Left
                end
                if(ent:GetName() == "CellCrazy") then
                    ent:Fire("lock", "", 0) -- Left
                end
            end

            if RemoveBreakableStuff then
                -- Remove the breakable door on the abandend house:
                if(ent:GetPos() == Vector(-2878,-129.08,133)) then
                    ent:Remove()
                end

                -- Remove the two breakable windows in the abandended house:
                if(ent:GetPos() == Vector(-2997,334.92,277)) then
                    ent:Remove()
                end
                if(ent:GetPos() == Vector(-2997,-87.08,277)) then
                    ent:Remove()
                end

                -- Remove those two physboxes on that camping shelter:
                if(ent:GetPos() == Vector(-1339,-6116.3,116.03)) then -- side one
                    ent:Remove()
                end
                if(ent:GetPos() == Vector(-1346.5,-6137.85,167.37)) then -- top one
                    ent:Remove()
                end
            end

            if RemoveIncinerator then
                -- Remove the incinerator:
                if(ent:GetPos() == Vector(3042.5,4499.5,138.5)) then
                    ent:Remove()
                end
            end

            if RemoveLabForceFields then
                -- Remove the doors + buttons from RBL:
                --[[ Door numbers:
                        2               3
                        1               4
                                   5
                ]]
                -- RBL Door 1:
                if(ent:GetPos() == Vector(10982,-12675.5,-989)) then
                    ent:Remove()
                end
                -- RBL Door 2:
                if(ent:GetPos() == Vector(10799,-12564.5,-996.5)) then
                    ent:Remove()
                end
                -- RBL Door 3:
                if(ent:GetPos() == Vector(10798,-12278.5,-996.5)) then
                    ent:Remove()
                end
                -- RBL Door 4:
                if(ent:GetPos() == Vector(10982,-12172.5,-989)) then
                    ent:Remove()
                end
                -- RBL Door 5:
                if(ent:GetPos() == Vector(11105.5,-12272,-989)) then
                    ent:Remove()
                end
                -- RBL Button 1.1:
                if(ent:GetPos() == Vector(10888.5,-12490,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 1.2:
                if(ent:GetPos() == Vector(10878.5,-12490,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 2.1:
                if(ent:GetPos() == Vector(10849.5,-12490,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 2.2:
                if(ent:GetPos() == Vector(10840.5,-12490,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 3.1:
                if(ent:GetPos() == Vector(10839.5,-12356,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 3.2:
                if(ent:GetPos() == Vector(10851.5,-12356,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 4.1:
                if(ent:GetPos() == Vector(10864.5,-12356,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 4.2:
                if(ent:GetPos() == Vector(10873.5,-12356,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 5.1:
                if(ent:GetPos() == Vector(10888.5,-12356,-1010.51)) then
                    ent:Remove()
                end
                -- RBL Button 5.2:
                if(ent:GetPos() == Vector(10897.5,-12356,-1010.51)) then
                    ent:Remove()
                end
            end

            if ShiftTeleporters then
                -- Move the inside RBL teleporter up:
                if(ent:GetName() == "labenterteleporttarget") then
                    ent:SetPos(Vector(10736.2998,-12385.9004,-954.0000)) -- 100 units UP
                end
                -- Move the outside RBL teleporter up:
                if(ent:GetName() == "labexitteleporttarget") then
                    ent:SetPos(Vector(-8947.1201,-11270.2002,173.0000)) -- 100 units UP
                end

                -- Move the outside ZoLo teleporter up:
                if(ent:GetName() == "zoloexitend") then
                    ent:SetPos(Vector(-7066.0000,-11520.0000,173.0000)) -- 100 units UP
                end
            end

            -- Make those damned lifts FASTER:
            if ent:GetName() == "TallBuild_Elev2" then
                ent:SetKeyValue("startspeed",othernewliftspeed)
            end
            if ent:GetName() == "lookatmeimaliftgoinguporgoingdown" then
                ent:SetKeyValue("startspeed",underliftspeed)
            end
        end

        /********************************************************
                   HUGE MOTHER FUCKING LIFT PATCH BELOW
        ********************************************************/

        if patchlift then
            -- Declare some stuff:
            local mdl = false
            local lift = false

            -- Lets grab some map ents:
            for k,v in pairs(ents.GetAll()) do
                -- This is the button, used for the model:
                if v:GetPos() == Vector(-7106,-9382,132) then
                    mdl = v:GetModel()  -- Store the model
                    v:Remove()          -- Now remove the button
                end

                -- This is the old elevator button:
                if v:GetPos() == Vector(-7115,-9354,144) then
                    v:Remove()  -- Remove the button
                end
                -- Second floor button
                if v:GetPos() == Vector(-7106,-9382,894) then
                    v:Remove()  -- Remove the button
                end
                -- Third floor button
                if v:GetPos() == Vector(-7122,-9382,1530) then
                    v:Remove()  -- Remove the button
                end
                -- Fourth floor button
                if v:GetPos() == Vector(-7124,-9379.24,2682.73) then
                    v:Remove()  -- Remove the button
                end

                -- Grab our lift entity
                if v:GetName() == "PDElevatorIsAPainInYourAss" then
                    lift = v    -- Store the lift entity
                end

                -- Lets remove the old track:
                if v:GetName() == "Floor4" then
                    v:SetKeyValue("OnPass","ash47_fm_01,Trigger,0,0,0")
                end
                if v:GetName() == "Floor2" then
                    v:SetKeyValue("OnPass","ash47_fm_02,Trigger,0,0,0")
                end
                if v:GetName() == "Floor3" then
                    v:SetKeyValue("OnPass","ash47_fm_03,Trigger,0,0,0")
                end
                if v:GetName() == "Floor5" then
                    v:SetKeyValue("OnPass","ash47_fm_04,Trigger,0,0,0")
                end

                -- Remove the old hooks:
                if v:GetName() == "relay_f1" then
                    v:Remove()
                end
                if v:GetName() == "relay_f2" then
                    v:Remove()
                end
                if v:GetName() == "relay_f3" then
                    v:Remove()
                end
            end

            -- Makesure everything was found:
            if not mdl then print("I couldn't find the correct model!") return end
            if not lift then print("I couldn't find the lift!") return end

            -- These are used to make the lift go the fastest route:
            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_02_f")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,StartForward,0,0,0")
            fm:Spawn()
            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_02_b")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,StartBackward,0,0,0")
            fm:Spawn()
            fm:Fire("Disable","",0)

            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_03_f")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,StartForward,0,0,0")
            fm:Spawn()
            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_03_b")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,StartBackward,0,0,0")
            fm:Spawn()
            fm:Fire("Disable","",0)

            -- These are used for floor management
            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_fm_01")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,Stop,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_02,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_03,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_04,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_02_f,Enable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_03_f,Enable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_02_b,Disable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_03_b,Disable,0,0,0")
            fm:Spawn()

            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_fm_02")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,Stop,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_01,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_03,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_04,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_03_f,Enable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_03_b,Disable,0,0,0")
            fm:Spawn()

            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_fm_03")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,Stop,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_01,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_02,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_04,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_02_f,Disable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_02_b,Enable,0,0,0")
            fm:Spawn()

            local fm = ents.Create("logic_relay")
            fm:SetName("ash47_fm_04")
            fm:SetKeyValue("OnTrigger","Ash47_Lift,Stop,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_01,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_02,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_btn_03,Unlock,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_02_f,Disable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_03_f,Disable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_02_b,Enable,0,0,0")
            fm:SetKeyValue("OnTrigger","ash47_03_b,Enable,0,0,0")
            fm:Spawn()


            -- Lets change the name of the lift:
            lift:SetName("Ash47_Lift")

            -- Lets make the lift go FASTER:
            lift:SetKeyValue("startspeed",newliftspeed)     -- Default is 100

            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_01")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7115,-9354,126))     -- Set it's position
            btn:SetAngles(Angle(0,180,0))          -- Rotate it
            btn:SetParent(lift)                     -- Attach our button to the lift
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Enable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Disable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","Ash47_Lift,StartBackward,0,0,0")

            -- Spawn it:
            btn:Spawn()

            --Disable the button
            btn:Fire("Lock","",0)

            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_01")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7117,-9381,142))     -- Set it's position
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Enable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Disable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","Ash47_Lift,StartBackward,0,0,0")

            -- Spawn it:
            btn:Spawn()

            --Disable the button
            btn:Fire("Lock","",0)


            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_02")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7115,-9354,134))     -- Set it's position
            btn:SetAngles(Angle(0,180,0))          -- Rotate it
            btn:SetParent(lift)                     -- Attach our button to the lift
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Enable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Disable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","ash47_02_f,Trigger,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_02_b,Trigger,0,0,0")

            -- Spawn it:
            btn:Spawn()

            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_02")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7106,-9382,894))     -- Set it's position
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Enable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Disable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","ash47_02_f,Trigger,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_02_b,Trigger,0,0,0")

            -- Spawn it:
            btn:Spawn()


            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_03")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7115,-9354,142))     -- Set it's position
            btn:SetAngles(Angle(0,180,0))          -- Rotate it
            btn:SetParent(lift)                     -- Attach our button to the lift
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Enable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Disable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","ash47_03_f,Trigger,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_03_b,Trigger,0,0,0")

            -- Spawn it:
            btn:Spawn()

            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_03")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7122,-9382,1530))    -- Set it's position
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Enable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Disable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","ash47_03_f,Trigger,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_03_b,Trigger,0,0,0")

            -- Spawn it:
            btn:Spawn()


            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_04")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7115,-9354,150))     -- Set it's position
            btn:SetAngles(Angle(0,180,0))          -- Rotate it
            btn:SetParent(lift)                     -- Attach our button to the lift
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Enable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","Ash47_Lift,StartForward,0,0,0")

            -- Spawn it:
            btn:Spawn()

            -- Create a button:
            local btn = ents.Create("func_button")  -- Create a new button
            btn:SetName("ash47_btn_04")             -- Give it a name
            btn:SetModel(mdl)                       -- Set it's model
            btn:SetPos(Vector(-7124,-9379,2682))    -- Set it's position
            btn:SetKeyValue("spawnflags","1025")    -- Use activates + don't move

            -- Enable only our floor:
            btn:SetKeyValue("OnPressed","ash47_fm_01,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_02,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_03,Disable,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_fm_04,Enable,0,0,0")

            --Disable buttons:
            btn:SetKeyValue("OnPressed","ash47_btn_01,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_02,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_03,Lock,0,0,0")
            btn:SetKeyValue("OnPressed","ash47_btn_04,Lock,0,0,0")

            -- Move the lift:
            btn:SetKeyValue("OnPressed","Ash47_Lift,StartForward,0,0,0")

            -- Spawn it:
            btn:Spawn()
        end
    end
end)


For use, place it in “garrysmod/garrysmod/lua/autorun/server/patch_evocity.lua”

Please keep in mind, I made most of this while I was learning lua, so it has some C++ sort of syntax, before I knew I could do certain things…

It has options at the top, they explain what they do, if anyone has any questions, or suggestions, feel free to post / ask :stuck_out_tongue:

Amazing. This script is absolutely amazing. Nothing worse than the nexus lift. Thanks man!

You shall have a big clap from me, amazing and will help a lot of people!

Nice, sounds useful

I actually had fun making this, learned so much, and It makes me happy that it can help someone else :stuck_out_tongue:

Wow thanks for this, will be very useful! :smiley:

I’m guessing that the focus of this script is function rather than efficiency, but just saying you could make this script a LOT quicker by using the “continue” keyword inside those gigantic for-loops (pretty sure Garry added that into gmod lua). Good work though, looks like a lot of effort went into it.

Never heard of it, I’ll google it tomorrow, thanks for the feedback, It executes in like a split second on my local PC anyways, and it is run once, so it doesn’t really matter :stuck_out_tongue:

This is insanely awesome. Thanks for this, running it on my server.

Good work, but this could be optimized greatly. Personally, I’d use tables in the giant for loop, and continues (like Splambob said). In general, creating logic_relays just to fire one output is kind of redundant, and since you’re firing “Enable” and “Disable” rather than just “Trigger”, you’re firing 3 outputs in total instead of just one. Also, you have 4 relays just to fire 2 ouputs, I’m not quite sure what the reasoning behind that is, but if it’s necessary you could just trigger one relay twice. But that’s just my two cents, good script regardless.

Ya, that wouldn’t surprise me, the script went through a lot of changes while I was making it, and it sounds like I’ve left some of those entities in there, as for the entities that are only activated or deactivated, I used them like logic, the lift either has to go up or down, depending on which floor it’s on, so I use them to work it out :stuck_out_tongue:

I thought there was an updated version of this map out already?

Good job, however it’d be better on a newer map :slight_smile:

I know there is a brand new map, that is an updated version of it, but it’s exactly that – a brand new map, it’s completely different, and all the patches I’ve seen are dodgy, people recompile then recompile the map and it wrecks it, looking in gmod server browser, lots of people still play this map…

Feel free to link me to the map if I’m wrong :stuck_out_tongue: