@name Portal
@outputs User:entity 
@persist A
interval(100)

if(first()) {    
    A = 0
}

Aim = owner():aimEntity():angles()

if (owner():weapon():type() == "weapon_physgun" & owner():keyUse()) {
    holoCreate(1)
    holoModel(1,"cplane")
    holoPos(1,owner():aimPos())
    holoAng(1,Aim+ang(0,0,-90))
    holoScale(1,vec(3,6,3))
    holoColor(1,vec(0,190,255))
    holoParent(1,entity())
}

if (owner():weapon():type() == "weapon_physgun" & owner():keyReload()) {
    holoCreate(2)
    holoModel(2,"cplane")
    holoPos(2,owner():aimPos())
    holoAng(2,Aim+ang(0,0,-90))
    holoScale(2,vec(3,6,3))
    holoColor(2,vec(255,178,0))
    holoParent(2,entity())
}

findInSphere(holoEntity(1):pos(), 8)
findIncludeClass("player")
User = findClosest(holoEntity(1):pos())

if(User:isPlayer()) {A = 1}
else {A = 0}

if(changed(A) & !first()) {
    if(A == 1) {
        User:teleport(holoEntity(2):pos()+vec(0,60,0))
    } else {
        holoDeleteAll()
    }
}
