Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. @name FDoor
  2. @inputs
  3. @outputs
  4. @persist [Foz Config Allowed Wirelinks]:table Players:array
  5. @trigger
  6. if(first()){
  7. #[-----------------------------------------
  8. Name: Config
  9. -----------------------------------------]#
  10. Config = table()
  11.  
  12. Config["prefix", string] = "!" # This is the prefix for the commands.
  13.  
  14. #[-----------------------------------------
  15. Name: Functions
  16. -----------------------------------------]#
  17. function fancyPrint(Text:string){
  18. printColor(vec(100, 100, 100), "[", vec(120, 255, 0), "FDoor", vec(100, 100, 100), "]: ", vec(255, 255, 255), Text)
  19. }
  20.  
  21. #[-----------------------------------------
  22. Name: Setup
  23. -----------------------------------------]#
  24. runOnChat(1)
  25.  
  26. Foz["Doors", table] = table()
  27. }
  28.  
  29. #[-----------------------------------------
  30. Name: Chat
  31. -----------------------------------------]#
  32. if(chatClk(owner())){
  33. local Ex = lastSaid():explode(" ")
  34.  
  35. if(Ex[1, string]:lower() == Config["prefix", string] + "add"){
  36. hideChat(1)
  37.  
  38. local Ply = findPlayerByName(Ex[2, string])
  39.  
  40. if(Ply:isPlayer()){
  41. if(Allowed[Ply:steamID(), number]){
  42. fancyPrint(Ply:name() + " is already on the whitelist!")
  43. }
  44. else{
  45. fancyPrint("Added " + Ply:name() + " to the whitelist.")
  46. Allowed[Ply:steamID(), number] = 1
  47.  
  48. Players:insertEntity(1, Ply)
  49. }
  50. }
  51. else{
  52. fancyPrint("Sorry, but I couldn't find player: " + Ex[2, string])
  53. }
  54. }
  55.  
  56. if(Ex[1, string]:lower() == Config["prefix", string] + "remove"){
  57. hideChat(1)
  58.  
  59. local Ply = findPlayerByName(Ex[2, string])
  60.  
  61. if(Ply:isPlayer()){
  62. if(!Allowed[Ply:steamID(), number]){
  63. fancyPrint(Ply:name() + " isn't on the whitelist!")
  64. }
  65. else{
  66. fancyPrint("Removed " + Ply:name() + " from the whitelist.")
  67. Allowed[Ply:steamID(), number] = 0
  68.  
  69. foreach(K, V:entity = Players){
  70. if(V == Ply){
  71. Players:remove(K)
  72. break
  73. }
  74. }
  75. }
  76. }
  77. else{
  78. fancyPrint("Sorry, but I couldn't find player: " + Ex[2, string])
  79. }
  80. }
  81.  
  82. if(Ex[1, string]:lower() == Config["prefix", string] + "add_door"){
  83. hideChat(1)
  84.  
  85. local Door = owner():aimEntity()
  86.  
  87. if(Door:isValid()){
  88. Foz["Doors", table]:insertEntity(1, Door)
  89.  
  90. Wirelinks[Door:id(), wirelink] = Door:wirelink()
  91.  
  92. fancyPrint("Added " + Door:toString() + " to your fading doors.")
  93.  
  94. Foz["Door " + Door:id(), table] = table()
  95.  
  96. Foz["Door " + Door:id(), table]["Material", string] = Door:getMaterial()
  97. Foz["Door " + Door:id(), table]["Color", vector4] = Door:getColor4()
  98. }
  99. else{
  100. fancyPrint("That's not a valid door!")
  101. }
  102. }
  103. }
  104.  
  105. #[-----------------------------------------
  106. Name: Detctions
  107. -----------------------------------------]#
  108. interval(100)
  109.  
  110. for(I=1, Foz["Doors", table]:count()){
  111. local Door = Foz["Doors", table][I, entity]
  112.  
  113. Foz["Door " + Door:id(), table]["Faded", number] = 0
  114.  
  115. foreach(K, V:entity = Players){
  116. if(V:pos():distance(Door:pos()) <= 100 & Allowed[V:steamID(), number]){
  117. Foz["Door " + Door:id(), table]["Faded", number] = 1
  118. }
  119. }
  120.  
  121. if(Foz["Door " + Door:id(), table]["Faded", number]){
  122. #Foz["Doors", table][I, entity]:noCollideAll(1)
  123. #Door:setColor(vec4(255, 255, 255, 0))
  124.  
  125. Wirelinks[Door:id(), wirelink]["Fade", number] = 1
  126. }
  127. else{
  128. #Foz["Doors", table][I, entity]:noCollideAll(0)
  129. #Door:setColor(Foz["Door " + Door:id(), table]["Color", vector4])
  130. #Door:setMaterial(Foz["Door " + Door:id(), table]["Material", string])
  131.  
  132. Wirelinks[Door:id(), wirelink]["Fade", number] = 0
  133. }
  134. }
  135.  
  136. #[-----------------------------------------
  137. Made By Fozie!
  138.  
  139. SteamID: STEAM_0:0:226129070
  140. Profile: http://steamcommunity.com/profiles/76561198412523868
  141. Discord: Fozie#5014
  142. -----------------------------------------]#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement