@name Bomber
@persist Prop:entity Player:entity Sounds:array Prop2:array C:entity CC:array Thrust:vector M A MM
@model models/hunter/plates/plate.mdl
if (first()){entity():setMaterial("models/props_c17/frostedglass_01a")
    entity():setColor(random(255),random(255),random(255))
    entity():setAlpha(0) 
    A = 1
    M = 200
} 
interval(100)
runOnChat(1)
    LastSaid = lastSaid()
    E = entity()
    P = owner()
    Thrust = (P:aimPos() - Prop:pos()) + Prop:massCenterL()
    Sounds[0, string] = "ambient/explosions/explode_5.wav"
    Sounds[1, string] = "ambient/explosions/explode_6.wav"
    Sounds[2, string] = "ambient/explosions/explode_7.wav"
    Sounds[3, string] = "ambient/explosions/explode_8.wav"
    Prop2[0, string] = "models/xqm/jetbody3.mdl"
    AA = LastSaid:explode(" ")
    AAA = AA:string(2):toNumber()
    M = AAA
    AAL = LastSaid:explode(" ")
    AAAL = AAL:string(2):toNumber()
    MM = AAAL*1000
    if(first()){
        print("Use !speed [time] to set the plane's spped. DEFAULT: 200")
        print("Use !bomb [time] to delay when the bombs spawns. (UNIT: SECONDS) DEFAULT 2.5")
    }
    if(changed(P:keyAttack2())& P:keyAttack2() &!Prop ){
        Prop = propSpawn(Prop2:string(round(random(0))), P:pos()+(vec(0,0,500)), P:eyeAngles()+ang(0,90,0), 0)
        P:soundPlay(0,0,Sounds:string(round(random(3))))
        Prop:setTrails(150,50,10, "trails/smoke", vec(100,100,100),250)
        Prop:setAlpha(255)
        Prop:propNotSolid(0)
        Prop:propGravity(0)
        explosion()
        timer("delete",50000)
        timer("res",MM)
        hint("SET THE PLANE'S SPEED WITH !speed NOW!",5)
    }
    if(P:keyUse()&Prop ){
        Prop:propFreeze(1)
        A = 0
    }else{
    A = 1
}
if(chatClk(owner())){
if(AA:string(1):lower()=="!speed"&Prop){
    hideChat(1)
        hint("SET SPEED: " +M:toString(),5)
}
if(AA:string(1):lower()=="!speed"&!Prop){
    hideChat(1)
        hint("USE !speed ONLY WHEN PLANE SPAWNS",5)
}
}
if(chatClk(owner())){
if(AAL:string(1)=="!bomb"){
    hideChat(1)
        hint("BOMB DELAY: " +M:toString() +" SECONDS",5)
}
}


    if((clk("res"))){
        M = AAA
        timer("res",100)
if(randint(1,4)==1&Prop){
    C = propSpawn("models/props_phx/mk-82.mdl",Prop:pos()+vec(random(-500,500),random(-500,500),-200),ang(90,90,90),0)
    CC:pushEntity(C)
}
}
if(clk("delete") & Prop) {
    Prop:propDelete()
    CC:shiftEntity():propBreak()
    stoptimer("res")
    stoptimer("del2")
    hint("Plane Dismissed",5)
    M = 200 
}
if(A){
    Prop:applyForce(Thrust*M)
    Prop:setAng(P:eyeAngles()+ang(0,90,0))
    Prop:propFreeze(0)
}
if(chatClk(owner())){
    if(P:lastSaid() == "!remove"){
        hideChat(1)
        Prop:propDelete()
        CC:shiftEntity():propDelete()
        stopAllTimers()
}
}
