@name Door Adder
@persist Allowed:array Door
runOnChat(1)
if (chatClk(owner()) & owner():lastSaid():sub(1,1)=="-") {
    hideChat(1)
    Args=owner():lastSaid():lower():explode(" ")
    if (Args[1,string]=="-reset") {print("Resetting") reset()}
    if (Args[1,string]=="-add") {
        Players=players()
        for (I=1, Players:count()) {
            if (Players[I,entity]:name():lower():matchFirst(Args[2,string])) {
                Allowed[Allowed:count()+1,entity]=Players[I,entity]
                print("Added "+Players[I,entity]:name()+" to door list")
                break
            }
        }
    }
    if (Args[1,string]=="-remove") {
        for (I=1, Allowed:count()) {
            if (Allowed[I,entity]:name():lower():matchFirst(Args[2,string])) {
                print("Popping "+Allowed[I,entity]:name()+" from table")
                Allowed:removeEntity(I)
            }
        }
    }
    if (Args[1,string]=="-door") {
        Door=0
        timer("Door",1200)
    }
}
if (clk("Door")) {
    Door++ 
    if (Door<=Allowed:count()) {
        concmd("say /addowner "+(Allowed[Door,entity]:name()))
        timer("Door",500)
    } else {
        print("Added "+(Allowed:count()+" users to coown door"))
    }
}
