@name GangSafe
@outputs A
@persist Allowed:array
runOnChat(1)
if (first()) {
    function entity chatClkGang() {
        for (I=1, Allowed:count()) {
            if (chatClk(Allowed[I,entity])) {return Allowed[I,entity]}
    }
    return noentity()
}
}
if (chatClk(owner()) & owner():lastSaid():sub(1,1)=="-") {
    hideChat(1)
    Args=owner():lastSaid():lower():explode(" ")
    if (Args[1,string]=="-reset") {print("Resetting gangsafe") 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 gangsafe 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 gangsafe table")
                Allowed:removeEntity(I)
            }
        }
    }
}

Args=array()
Player=chatClkGang()
Args=Player:lastSaid():lower():explode(" ")
if (Args:count()==0) {Args[1,string]=Player:lastSaid():lower()} 
if (Args[1,string]=="-safe") {A=1 timer("noa",10)}
if (clk("noa")) {A=0}
