@name NoPick
@persist Players:array Allowed:array Alarm Alarming Player:entity
@inputs L
@model models/dav0r/camera.mdl
interval(1000)
if (first()) {
    concmd("say /channel 13")
    function number picking(E:entity) {
        for (I=1, Allowed:count()) {
            if (E==Allowed[I,entity]) {return 0 print("OK")}
        }
        if (E:weapon():type():lower():matchFirst("pick") | E:weapon():type():lower():matchFirst("ram") | E:weapon():type():lower():matchFirst("crack")) {if (L==0) {print(_HUD_PRINTCENTER,"Raid in progress!")} Alarm=1 return 1}
    Alarm=0
    return 0
}
}
runOnChat(1)
if (chatClk(owner()) & owner():lastSaid():sub(1,1)=="-") {
    hideChat(1)
    Args=owner():lastSaid():lower():explode(" ")
    if (Args[1,string]=="-reset") {print("Resetting antipick") 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 antipick 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()+" antipick table")
                Allowed:removeEntity(I)
            }
        }
    }
}

findByClass("player")
Player=findClosest(entity():pos())
if (Player:pos():distance(entity():pos())>200) {Player=noentity()}
picking(Player)
if (Alarm & !Alarming & L==0) {
    Alarming=1
    for (I=1, 7) {
        soundPlay(I,0,"ambient/alarms/klaxon1.wav")
    }
    print(_HUD_PRINTCENTER,"Raid in progress!")
    printColor(vec(255,0,0),"Raid in progress!")
    concmd("say /radio A raid is in progress!")
}
if (!Alarm) {Alarming=0 soundPurge()}
