NotFound.Tech E2 Smart Opener

NotFound.Tech E2 Smart Opener

In-order to use the NotFound.Tech Smart Opener, just copy and paste one of the versions into the Expression 2 Editor and save it. Place it then wire it to a Numpad Output which is set to your Fading Door Key.

v1.1.0 (Latest)

@name NFT Smart Opener (Official)


@inputs LockDoorNumpad


@outputs FadingDoor


@persist P:array Target:entity LockDoor:number PreventEntry:number


@trigger


# Version - 1.1.0 #


# Settings #


Distance = 50 # Distance from E2 For Fading Door To Open! (Make this higher if you place your e2 far away from your door) #


Faction = 1 # Make this 1 to make it faction wide access! ( Unless you dont want your faction to access your door there is no reason to make this 0 ) #


Multiple = 0 # Make this 1 for your 2nd, 3rd, 4th ect. chip! (This will disable certain things that would make having more chips annoying) #


if ( first() ) {


    LockDoor = 0 # Lock this door preventing entry by everyone. #

    PreventEntry = 1 # Make this 1 in order to prevent entry to the door when someone who cannot access it is nearby. ( Means you wont be able to leave through the door in these situations ) #


}


# Do Not Edit Anything Below This Line! #


runOnChat(1)


interval(300)


Placer = owner():lastSaid():explode( " " )


if ( chatClk( owner() ) && ( Placer[1, string]:find( "!" ) || Placer[1, string]:find( "/" ) ) ) {


    switch( Placer[1, string]:sub( 2 ) ) {

     

        case "help",

 

            hideChat( 1 )

         

            if ( Multiple == 1 ) { break }

 

            printColor( vec( 0, 255, 150 ), " - NFT Smart Opener (Official) Chat Command List -" )

            printColor( vec( 0, 255, 150 ), " !add (Usage - !add Players Name) this will add a player to the smart opener" )

            printColor( vec( 0, 255, 150 ), " !del (Usage - !del Players Name) this will remove a player from the smart opener!" )

            printColor( vec( 0, 255, 150 ), " !list (Usage - !list) this will list all current players added to the smart opener!" )

            printColor( vec( 0, 255, 150 ), " !lock (Usage - !lock) this will lock/unlock your door based on the value! Currently: " + LockDoor )

            printColor( vec( 0, 255, 150 ), " !prevent (Usage - !prevent) this will prevent entry to your door when another player is near based on the value! Currently: " + PreventEntry )

 

        , break

 

        case "list",

 

            hideChat( 1 )

 

            if ( Multiple == 1 ) { break }

 

            printColor( vec( 255, 255, 255 ), "- Current Players Added -" )

         

            if ( P:count() >= 1 ) {

 

                foreach( K, V:entity=P ) {

          

                   printColor( vec( 255, 255, 255 ), V:name() )

             

                }

             

            } else {

         

                printColor( vec( 255, 0, 0 ), "No Players Currently Added" )

         

            }

 

        , break

 

        case "add",

     

            hideChat( 1 )

     

            Add = findPlayerByName( Placer[2, string] )

     

            PlayerAdded = Placer[2, string]

     

            if ( PlayerAdded == "" ) {

     

                if ( Multiple == 0 ) {

     

                  printColor( vec( 255, 0, 0 ), "You did not enter a players name!" )

     

                }

     

            } else {

     

                if( Add:isPlayer() && Add != owner() ) {

     

                    Target = Add

     

                    P:pushEntity(Add)

     

                    if ( Multiple == 0 ) {

     

                       printColor( vec( 0, 255, 0 ), "You added ", Add:name(), " to your smart opener!" )

     

                    }

     

                } else {

     

                    if ( Multiple == 0 ) {

     

                        printColor( vec( 255, 0, 0 ), PlayerAdded, " Is not a valid player!")

     

                    }

     

                }

     

            }, break

     

        case "del",

     

            hideChat( 1 )

     

            Remove = findPlayerByName( Placer[2, string] )

     

            PlayerRemoved = Placer[2, string]

     

            if ( PlayerRemoved == "" ) {

     

                if ( Multiple == 0 ) {

     

                   printColor( vec( 255, 0, 0 ), "You did not enter a players name!" )

     

                }

     

            } else {

     

                if ( Remove:isPlayer() ) {

     

                    for( PN = 1, P:count() ) {

     

                        if ( Remove == P[PN,entity]) {

     

                            P:remove(PN)

     

                        }

     

                    }

     

                    if ( Multiple == 0 ) {

     

                       printColor( vec( 0, 255, 0 ), "You removed ", Remove:name(), " from your smart opener!" )

     

                    }

     

                } else {

     

                    if ( Multiple == 0 ) {

     

                       printColor( vec( 255, 0, 0 ), PlayerRemoved, " Is not a valid player!")

     

                    }

     

                }

             

            }, break

         

        case "lock",

     

            hideChat( 1 )

     

            switch ( LockDoor ) {

          

                case 0, LockDoor = 1 printColor( vec( 255, 0, 0 ), "Your door is now forcefully locked." ), break

                case 1, LockDoor = 0 printColor( vec( 0, 255, 0 ), "Your door is no longer forcefully locked." ), break

            

            }

     

        , break

     

        case "prevent",

     

            hideChat( 1 )

     

            switch( PreventEntry ) {

          

                case 0, PreventEntry = 1 printColor( vec( 255, 0, 0 ), "Your door is now forcefully locked when another player is nearby." ), break

                case 1, PreventEntry = 0 printColor( vec( 0, 255, 0 ), "Your door is no longer forcefully locked when another player is nearby." ), break

            

            }

         

        , break

     

    }

 

}


FadingDoor = 0


findIncludeClass("player")

findInSphere(entity():pos(), Distance)


foreach( K, V:entity=findToArray() ) {

 

    if ( LockDoor == 1 || LockDoorNumpad == 1 ) {

  

        FadingDoor = 0

     

        break

    

    }


    if ( V == owner() ) {


        FadingDoor = 1


    } elseif ( Faction == 1 && owner():team():teamName() != "No Faction" && V:team() == owner():team() && V != owner()  ) {


        FadingDoor = 1


    } else {


        if ( P:count() >= 1 && V != owner() && V:team() != owner():team() ) {


            for ( PN = 1, P:count() ) {


                if ( V == P[PN,entity] && FadingDoor == 0 )  {


                    FadingDoor = 1


                    break


                } else {

             

                    if ( PreventEntry == 1 ) { FadingDoor = 0 }

             

                }


            }


        }

     

        if ( P:count() < 1 && PreventEntry == 1 ) { FadingDoor = 0 }


    }


}


if ( duped() ) {


    printColor( vec( 255, 0, 0 ), "The NFT Smart Opener (Official) is not dupable!" )


    selfDestruct()


} elseif ( first() ) {


    printColor( vec( 0, 150, 150 ), "NFT Smart Opener (Official) Initialized (Type !help for the commands)" )


    printColor( vec( 0, 150, 150 ), "NFT Smart Opener (Official) Created by RockerOfWorlds" )


}


[/CODE]

v1.0.2

@name NFT Smart Opener (Official)

@inputs

@outputs FadingDoor

@persist P:array Target:entity PN Amount

@trigger


# Version - 1.0.2 #


# Settings #


Distance = 50 # Distance from E2 For Fading Door To Open! (Make this higher if you place your e2 far away from your door) #

Faction = 1 # Make this 1 to make it faction wide access! #

Multiple = 0 # Make this 1 for your 2nd, 3rd, 4th ect. chip! (This will disable certain things that would make having more chips annoying) #


# Do Not Edit Anything Below This Line! #


runOnChat(1)


interval(300)


Placer = owner():lastSaid():explode( " " )


if ( Multiple == 0 ) {


    if ( Placer[1, string] == "!help" & chatClk(owner()) ) {


        hideChat( 1 )


        print(" - NFT Smart Opener (Official) Chat Command List - ")

        print(" !add (Usage - !add Players Name) this will add a player to the smart opener")

        print(" !del ( Usage - !remove Players Name) this will remove a player from the smart opener!")

        print(" !list ( Usage - !list) this will list all current players added to the smart opener!")

 

    }


    if ( Placer[1, string] == "!list" & chatClk(owner()) ) {

   

        hideChat( 1 )

   

        print("- Current Players Added -")

        print(P)

 

    }


}


if ( Placer[1, string] == "!add" & chatClk(owner()) ) {


    hideChat( 1 )

    Add = findPlayerByName( Placer[2, string] )

    PlayerAdded = Placer[2, string]


    if ( PlayerAdded == "" ) {

   

        if ( Multiple == 0 ) {

   

          print( "You did not enter a players name!" )

   

        }

       

    }


    else {



        if( Add:isPlayer() && Add != owner() ) {

       

            Target = Add

            P:pushEntity(Add)

       

            if ( Multiple == 0 ) {

           

               print( "You added", Add:name(), "to your smart opener!" )

       

            }

       

        }

       

        else {

       

            if ( Multiple == 0 ) {

       

                print(PlayerAdded, "Is not a valid player!")

           

            }

       

        }


    }


}


elseif ( Placer[1, string] == "!del" & chatClk(owner()) ) {


    hideChat( 1 )

    Remove = findPlayerByName( Placer[2, string] )

    PlayerRemoved = Placer[2, string]


    if ( PlayerRemoved == "" ) {

   

        if ( Multiple == 0 ) {

   

           print( "You did not enter a players name!" )

   

        }

       

    }


    else {

   

        if ( Remove:isPlayer() ) {

       

            while( PN < 40 ) {

                if ( Remove == P[PN,entity]) {

               

                    P:remove(PN)

               

                }

           

                PN++

            }

   

            if ( Multiple == 0 ) {

   

               print( "You removed", Remove:name(), "from your smart opener!" )

       

            }

   

        }

   

        else {

       

            if ( Multiple == 0 ) {

   

               print(PlayerRemoved, "Is not a valid player!")

       

            }

           

        }


    }


    PN = 0


}


FadingDoor = 0


findIncludeClass("player")

findExcludeClass("phys_props")


if ( findInSphere(entity():pos(), Distance) ) {




    if ( find() == owner() ) {

       

          FadingDoor = 1

       

    }

   

    elseif ( Faction == 1 && owner():team():teamName() != "No Faction" && find():team() == owner():team() && find() != owner()  ) {

   

        FadingDoor = 1

   

    }


    else {

   

        if ( P:count() >= 1 ) {

   

            while( PN <= P:count() ) {

           

                if ( find() == P[PN,entity] && FadingDoor == 0 )  {

               

                    FadingDoor = 1

                   

                }

           

                PN++

           

            }

   

        }


    }


    PN = 0


}


InitialSpawn = first()


if ( duped() ) {


    print( "The NFT Smart Opener (Official) is not dupable!" )


    selfDestruct()


}


elseif ( InitialSpawn == 1 ) {

   

    print( "NFT Smart Opener (Official) Initialized (Type !help for the commands)" )

    print( "NFT Smart Opener (Official) Created by RockerOfWorlds" )


}