@name Hit_Helper_V2
@inputs EGP:wirelink
@outputs 
@persist Target:entity
@trigger 
runOnTick(1)
runOnChat(1)

if(chatClk(owner())){
    Chat = owner():lastSaid():explode(" ")
    if(Chat:string(1)=="/f"){
        hideChat(1)
        Name = owner():lastSaid():sub(4)
        Target = findPlayerByName(Name)
        }
    }

if(first()){
    entity():setAlpha(0)
    #Making constants that do not need to be updated
    EGP:egpText(1, "Target: ", vec2(1550,30))
    EGP:egpSize(1, 30)
    EGP:egpText(2, "Distance: ",vec2(1550, 90))
    EGP:egpSize(2, 30)
    EGP:egpText(3, "Health: ", vec2(1550, 150))
    EGP:egpSize(3, 30)
    EGP:egpText(4, "Job: ", vec2(1550, 210))
    EGP:egpSize(4, 30)
    EGP:egpSize(5, 30)
    EGP:egpSize(6, 30)
    EGP:egpSize(7, 30)
    EGP:egpSize(8, 30)
    }
#turning the information into variables for easier use

Name = Target:name()
Distance = floor(Target:pos():distance(owner():pos()))
Health = Target:health()
Job = Target:team():teamName()


#creating egp objects for the variables


EGP:egpText(5, Name, vec2(1700, 30))
EGP:egpText(6, "" + Distance, vec2(1700, 90))
EGP:egpText(7, "" + Health, vec2(1700, 150))
EGP:egpText(8, Job, vec2(1700, 210))

if(Distance > 2000){
    EGP:egpColor(6, vec(255,0,0))
    Trig = 0
    }
elseif(Distance < 2000){
    EGP:egpColor(6, vec(0,255,0))
    Trig = 1
    }
    
if(owner():aimEntity()==Target){
    print(_HUD_PRINTCENTER, "TARGET")
    }


