@name Finder
@inputs [Pod Cam]:wirelink Tp:entity 
@outputs Current Find:entity FindItems:array 
@persist CamEnable Mouse1 Mouse2 
@trigger 
interval(10)

#findByClass("ngii_c_printer")
#findByClass("ngii_a_printer")
#findByClass("ngii_e_printer")
#findByClass("spawned_shipment")
#findByClass("darkrp_cheque")
#findByClass("spawned_weapon")
#findByClass("spawned_money")
FindItems = findToArray()
Find = FindItems[Current,entity ]

local Seat = Pod["Entity",entity]
local Driver = Seat:driver()
local W = Driver:keyForward()
local S = Driver:keyBack()
local Alt = Driver:keyWalk()
Mouse1 = Driver:keyAttack1()
Mouse2 = Driver:keyAttack2()

Cam["Activated",number] = CamEnable

if (S || CamEnable) {
    CamEnable = 1
    
    if (!holoEntity(1)) {holoCreate(1) holoAlpha(1,0)}
    
    holoPos(1,Find:pos() + vec(0,0,25))
    
    Cam["Position", vector] = holoEntity(1):pos()
    Cam["Parent", entity] = holoEntity(1)
}

if (W) {holoDelete(1) CamEnable = 0}
if (Alt) {Find:teleport(Tp:pos() + vec(0,0,20))}
if (changed(Alt) & Alt) {Find:soundPlay(1,0,"vo/npc/barney/ba_laugh04.wav")}
if (changed(Mouse1) & Mouse1) {Current++}
if (changed(Mouse2) & Mouse2) {Current--}

Current = clamp(Current,0,FindItems:count())
