Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @name FDoor
- @inputs
- @outputs
- @persist [Foz Config Allowed Wirelinks]:table Players:array
- @trigger
- if(first()){
- #[-----------------------------------------
- Name: Config
- -----------------------------------------]#
- Config = table()
- Config["prefix", string] = "!" # This is the prefix for the commands.
- #[-----------------------------------------
- Name: Functions
- -----------------------------------------]#
- function fancyPrint(Text:string){
- printColor(vec(100, 100, 100), "[", vec(120, 255, 0), "FDoor", vec(100, 100, 100), "]: ", vec(255, 255, 255), Text)
- }
- #[-----------------------------------------
- Name: Setup
- -----------------------------------------]#
- runOnChat(1)
- Foz["Doors", table] = table()
- }
- #[-----------------------------------------
- Name: Chat
- -----------------------------------------]#
- if(chatClk(owner())){
- local Ex = lastSaid():explode(" ")
- if(Ex[1, string]:lower() == Config["prefix", string] + "add"){
- hideChat(1)
- local Ply = findPlayerByName(Ex[2, string])
- if(Ply:isPlayer()){
- if(Allowed[Ply:steamID(), number]){
- fancyPrint(Ply:name() + " is already on the whitelist!")
- }
- else{
- fancyPrint("Added " + Ply:name() + " to the whitelist.")
- Allowed[Ply:steamID(), number] = 1
- Players:insertEntity(1, Ply)
- }
- }
- else{
- fancyPrint("Sorry, but I couldn't find player: " + Ex[2, string])
- }
- }
- if(Ex[1, string]:lower() == Config["prefix", string] + "remove"){
- hideChat(1)
- local Ply = findPlayerByName(Ex[2, string])
- if(Ply:isPlayer()){
- if(!Allowed[Ply:steamID(), number]){
- fancyPrint(Ply:name() + " isn't on the whitelist!")
- }
- else{
- fancyPrint("Removed " + Ply:name() + " from the whitelist.")
- Allowed[Ply:steamID(), number] = 0
- foreach(K, V:entity = Players){
- if(V == Ply){
- Players:remove(K)
- break
- }
- }
- }
- }
- else{
- fancyPrint("Sorry, but I couldn't find player: " + Ex[2, string])
- }
- }
- if(Ex[1, string]:lower() == Config["prefix", string] + "add_door"){
- hideChat(1)
- local Door = owner():aimEntity()
- if(Door:isValid()){
- Foz["Doors", table]:insertEntity(1, Door)
- Wirelinks[Door:id(), wirelink] = Door:wirelink()
- fancyPrint("Added " + Door:toString() + " to your fading doors.")
- Foz["Door " + Door:id(), table] = table()
- Foz["Door " + Door:id(), table]["Material", string] = Door:getMaterial()
- Foz["Door " + Door:id(), table]["Color", vector4] = Door:getColor4()
- }
- else{
- fancyPrint("That's not a valid door!")
- }
- }
- }
- #[-----------------------------------------
- Name: Detctions
- -----------------------------------------]#
- interval(100)
- for(I=1, Foz["Doors", table]:count()){
- local Door = Foz["Doors", table][I, entity]
- Foz["Door " + Door:id(), table]["Faded", number] = 0
- foreach(K, V:entity = Players){
- if(V:pos():distance(Door:pos()) <= 100 & Allowed[V:steamID(), number]){
- Foz["Door " + Door:id(), table]["Faded", number] = 1
- }
- }
- if(Foz["Door " + Door:id(), table]["Faded", number]){
- #Foz["Doors", table][I, entity]:noCollideAll(1)
- #Door:setColor(vec4(255, 255, 255, 0))
- Wirelinks[Door:id(), wirelink]["Fade", number] = 1
- }
- else{
- #Foz["Doors", table][I, entity]:noCollideAll(0)
- #Door:setColor(Foz["Door " + Door:id(), table]["Color", vector4])
- #Door:setMaterial(Foz["Door " + Door:id(), table]["Material", string])
- Wirelinks[Door:id(), wirelink]["Fade", number] = 0
- }
- }
- #[-----------------------------------------
- Made By Fozie!
- SteamID: STEAM_0:0:226129070
- Profile: http://steamcommunity.com/profiles/76561198412523868
- Discord: Fozie#5014
- -----------------------------------------]#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement