@name ADMIN CHAT AUTOTELEPORT
@inputs 
@outputs R:array
@persist [O E]:entity EGP:wirelink
@model

if(first()|dupefinished()){
if(owner():steamID() != "STEAM_0:0:56021974"){
        soundPlay(3, 12, "/buttons/weapon_cant_buy.wav")
        entity():propNotSolid(1)
        print("SORRY, THIS IS NOT YOUR E2 or DUPE.. YOU HAVE TAKEN IT WITHOUT PERMISSION")
        selfDestructAll()
    }
}

if( dupefinished() ){ reset() }

if( first() )
{
    #runOnTick(1)
    runOnChat(1)
    #runOnLast(1)
    
    O = owner()
    E = entity():isWeldedTo() ?: entity()
    
    EGP = E:wirelink()
    EGP:egpClear()
    
    function number getID( N )
    {
        return EGP:egpNumObjects() + N
    }
    
    EGP:egpRoundedBox( getID(1), vec2(256), vec2(512+8) )
    EGP:egpRadius( getID(0), 5 )
    EGP:egpColor( getID(0), hsv2rgb(200,1,100) )
    
    EGP:egpTextLayout( getID(1), "", vec2(), vec2(512) )
}

if( chatClk() )
{

    local Ls = lastSpoke()
    R:pushString( Ls:name() + ": " + Ls:lastSaid() )
    
    if( R:count() > 28 )
    {
        R:remove(1)
    }
    A=Ls:lastSaid():explode(" ")
    
    if(A[1,string]=="//  Help" & !Ls:isAdmin()){
        owner():teleport(Ls:pos()+vec(0,50,0))
    }
    
    EGP:egpSetText( 2, R:concat("\n") )
}

