December 11, 2017, 10:47 pm

Author Topic: E2 REQUEST  (Read 294 times)

Offline Jorin21

  • ByB Newbie
  • *
  • Posts: 1
    • View Profile
E2 REQUEST
« on: August 08, 2017, 02:32 am »
Hi, ive been trying to make this alarm system where you can input players and they wont be detected by the alarm. However, everyone who isnt add to the "whitelist" will breach the alarm and make it go off. Can someone help with this thank you.

Offline EmekPCgame

  • ByB Rookie
  • **
  • Posts: 91
    • View Profile
Re: E2 REQUEST
« Reply #1 on: December 03, 2017, 12:32 pm »
Here, I've made something, I'm not sure its complete but its working.

Commands:
!add <Name> -- add player to the whitelist.
!remove <Name> -- remove player from the whitelist.

Code: [Select]
@name Alarm system
@inputs
@outputs
@persist List:table

interval( 150 )
runOnChat( 1 )

if(first()){
    List[owner():steamID(), entity] = owner()
    }

if(chatClk(owner())){
    local A = owner():lastSaid():explode(" ")
   
    if(A[1,string]== "!add" ){
        hideChat(1)
        local Find = findPlayerByName(A[2,string])
       
        if(!List[Find:steamID(), entity] && Find:isPlayer()){
            List[Find:steamID(), entity] = Find
            print("Added "+Find:name())
            }
        }
       
    if(A[1,string]== "!remove" ){
        hideChat(1)
        local Find = findPlayerByName(A[2,string])
       
        if(List[Find:steamID(), entity]){
            List:remove(Find:steamID())
            print("Removed "+Find:name())
            }
        }
    }

findInSphere(entity():pos(), 50)
findClipToClass("Player")
Target = find()

    if( Target & Target:isAlive() ){
           
        if(!List[Target:steamID(), entity]){
               
            soundPlay(1, 1, "ambient/alarms/alarm1.wav")
            soundVolume(1, 100)
           
        }
       
    }



     

Have fun!