@name FailCake SpyBot Satelly
@inputs Cam:wirelink CakeSeat:wirelink XWL:wirelink Driver:entity
@outputs M
@persist Status:string Hint Chosse D Timer



interval(1)

#XWL:egpDraw() 

Act = CakeSeat:number("Active")
Up = CakeSeat:number("PrevWeapon")
Down = CakeSeat:number("NextWeapon")
Zoom = CakeSeat:number("Shift")
if(Down | Up ){Hint = 0}

findByClass("player")
A = findToArray()
M = A:count()
D = clamp(D,1,M)
D += (Up-Down)
E = A[D,entity]
O = E

Drivers = Driver:driver():name()
if(Zoom){Cam:setVector("Position",O:pos()+vec(0,0,90))}else{
Cam:setVector("Position",O:pos()+vec(0,0,200))
}  
Cam:setVector("Direction",O:forward())


Bearing = CakeSeat:number("Bearing")
Pitch = CakeSeat:number("Elevation")

Cam:setAngle("Angle",ang(90,Bearing,0))

#XWL:egpBox(0,0,0,900,900,0,0,50,255)
#XWL:egpText(1,"Spying " + O:name()+".",0,110,255,255,255,255)
#XWL:egpSetText(1,"Spying " + O:name()+".")
#XWL:egpSetFont(1,"lucida console",30)

#XWL:egpText(2,"Spy = " + Drivers +".",0,150,255,255,255,255)
#XWL:egpSetText(2,"Spy = " + Drivers +".")
#XWL:egpSetFont(2,"lucida console",30)

#XWL:egpText(3,"Satelly = " + Status +".",0,190,255,255,255,255)
#XWL:egpSetText(3,"Satelly = " + Status +".")
#XWL:egpSetFont(3,"lucida console",30)

#XWL:egpText(4,"FailCake Spying Satellly",0,20,255,255,255,255)
#XWL:egpSetText(4,"FailCake Spying Satellly")
#XWL:egpSetFont(4,"lucida console",30)

#XWL:egpText(5,"---------------------------------------",0,70,255,255,255,255)
#XWL:egpSetText(5,"-----------------------------------")
#XWL:egpSetFont(5,"lucida console",30)

if(Act){
Status = "In use"
Hint += 0.1
if(Hint == 1){
hint("Spying : "+O:name()+ " .Spy : "+Drivers+".",100)
Driver:hintDriver("Spying : "+O:name()+ " .Spy : "+Drivers+".",100)
}
if(Hint > 100){
Hint = 0
}
}else{
Hint = 0
Status = "Not In Use" }
Timer+=1

if(Timer >= 181){Timer = 0}

#holoTextCreate(1)
#holoTextPos(1,O:pos()+vec(0,0,190))
#holoText(1,"Im being Spyed :O")
#holoTextScale(1,1)
#holoTextColor(1,vec4(255,100,0,255))
#holoTextAng(1,ang(0,Timer,90))
#holoTextFont(1,"HUDNumber3")

Act = CakeSeat:number("Active")
Up = CakeSeat:number("PrevWeapon")
Down = CakeSeat:number("NextWeapon")
Zoom = CakeSeat:number("Shift")
if(Down | Up ){Hint = 0}

findByClass("player")
A = findToArray()
M = A:count()
D = clamp(D,1,M)
D += (Up-Down)
E = A[D,entity]
O = E

Drivers = Driver:driver():name()
if(Zoom){Cam:setVector("Position",O:pos()+vec(0,0,90))}else{
Cam:setVector("Position",O:pos()+vec(0,0,200))
}  
Cam:setVector("Direction",O:forward())


Bearing = CakeSeat:number("Bearing")
Pitch = CakeSeat:number("Elevation")

Cam:setAngle("Angle",ang(90,Bearing,0))

if(duped()){selfDestructAll()}
if(duped()){selfDestructAll()}
if(duped()){selfDestructAll()}

