June 02, 2020, 03:45 am

Rates Given - Scriptis

Pages: [1]
1
Wire / E2 / Wireless Multidoor
Burrrrnnn Burrrrnnn
on April 07, 2014, 01:52 am to Kgwilson
GG Scriptis
Thanks to Rendrek for the idea
Code: [Select]
@name Kgwilson wireless multidoor opener
@persist Allow:array Doors:array Zoom
interval(400)
if(first()) {
setName(owner():name()+" wireless multidoor opener")
    print("Put a fading door on a prop, push suit zoom to make it a auto door.\n-add <name>\n-rem <name>\n-list\n-removeall")
    runOnChat(1)
    Allow[1,entity]=owner()
}
Zoom=owner():keyZoom()
if(($Zoom&Zoom)==1&owner():aimEntity():type()=="prop_physics") {
    if(Doors:count()==0) {
        Doors:pushWirelink(owner():aimEntity():wirelink())
print("Added door")
    }else{
    Already=0
        for(I=1,Doors:count()) {
            if(owner():aimEntity()==Doors[I,entity]) {
                Already=1
                break
            }
        }
        if(Already==1) {
            printColor(vec(255,0,0),"Already added.")

        }else{
        Doors:pushWirelink(owner():aimEntity():wirelink())
print("Added door")
    }
    }
}
for(X=1,Allow:count()) {
    for(I=1,Doors:count()) {
        if(Allow[X,entity]:pos():distance(Doors[I,wirelink]:entity():pos())<=30) {
            Doors[I,wirelink]["Fade",number]=1
            BreakLoop=1
            break
        }else{
            Doors[I,wirelink]["Fade",number]=0
           
        }
    }
    if(BreakLoop==1) {break}
}
if(chatClk(owner())) {
    A=owner():lastSaid():explode(" ")
    if(A[1,string]=="-add") {
        hideChat(1)
        Already=0
        TargetPlayer=findPlayerByName(A[2,string])
            if(TargetPlayer:isPlayer()) {
                for(I=1,Allow:count()) {
                    if(TargetPlayer==Allow[I,entity]) {
                        Already=1
                        printColor(vec(255,0,0),""+TargetPlayer:name()+" is already allowed")
                        break
                    }
                }
                if(Already==0) {
                    Allow:pushEntity(TargetPlayer)
                    printColor(vec(0,255,0),"Added "+TargetPlayer:name()+" to allow list")
                }
            }else{print("Not a player")} 
    }
    if(A[1,string]=="-rem") {
    hideChat(1)
    TargetPlayer=findPlayerByName(A[2,string])
    if(TargetPlayer:isPlayer()) {
        for(I=1,Allow:count()) {
            if(TargetPlayer==owner()) { print("Can't do that,sorry!") break }
                if(TargetPlayer==Allow[I,entity]) {
                    Allow:remove(I)
                    printColor(vec(255,0,0),"Removed "+TargetPlayer:name()+" from allow list")
                }
            }
        }
    }
    if(A[1,string]=="-removeall") {
        hideChat(1)
        Allow:clear()
        Allow[1,entity]=owner()
        printColor(vec(255,0,0),"Cleared everybody but you")       
    }
    if(A[1,string]=="-list") {
        hideChat(1)
        for(I=1,Allow:count()) {
            print(Allow[I,entity]:name())
        }
    }
}
How to use
Fading door -> prop
Bind a key to suit zoom, press it while looking at your prop
Default fades at 30 units from the prop
Enjoy
Pages: [1]