Pushok icon

Expression2 Bot

Pushok | PRO | 12/24/11 03:20:18 PM UTC | 0 ⭐ | 338 👁️ | Never ⏰ | []
JavaScript |

3.81 KB

|

None

|

0 👍

/

0 👎

@name Something_Funny 
 
#defines
@persist ToOwnerBearing:normal Coef:normal HandFromBody:normal
@persist IndexBody IndexHead IndexHand
@persist BodyPos:vector HeadPos:vector HandPos:vector
@persist BodySize:vector HeadSize:vector HandSize:vector
@persist BodyAng:angle HeadAng:angle HandAng:angle
@persist BodyColor:vector HeadColor:vector HandColor:vector
@persist HandTop ChipPos:vector BallIndex
 
@persist OldVictimPos:vector OldWeaponPos:vector OldWeaponAngles:angle
@persist LenFromBallToTarget CurrentLength Clock Acceleration
 
#@persist TimeOfChat
#end
 
function normal createTheBall( VictimPos:vector, WeaponPos:vector )
{
    Index = randint( 4, 100 )
    
    BallSize = vec( 0.4, 0.4, 0.4 )
    BallColor = vec( 0, 0, 0 )
    BallOrigin = WeaponPos
    
    
    holoCreate( Index, BallOrigin, BallSize, ang( 0, 0, 0 ), BallColor )
    holoModel( Index, "sphere", 0 )
    
    return Index
}
 
interval( 50 )
runOnChat( 1 )
 
if( first() )
{
    ChipPos = entity():pos()
    
    Coef = 6
    Acceleration = 3.5
    TimeOfChat = 0
    
    HandFromBody = 2*Coef + 0.8*Coef
    HandTop = 5*Coef*2 - 3*Coef
    
    BodyPos = ChipPos + vec( 0, 0, 5*Coef )
    HeadPos = ChipPos + vec( 0, 0, 2.5*Coef + 5*Coef*2)
    HandPos = ChipPos + vec( 0, HandFromBody, HandTop )
    
    HandSize = vec( 0.8, 0.8, 3 )
    BodySize = vec( 2, 2, 5 )
    HeadSize = vec( 2.5, 2.5, 2.5 )
    
    HandAng = ang( 0, 0, 0 )
    BodyAng = ang( 0, 0, 0 )
    HeadAng = ang( 0, 0, 0 )
    
    BodyColor = vec( 255, 0, 0 )
    HeadColor = vec( 0, 255, 0 )
    HandColor = vec( 0, 0, 255 )
    
    IndexBody = 1
    IndexHead = 2
    IndexHand = 3
    
    holoCreate( IndexHand, HandPos, HandSize, HandAng, BodyColor )
    holoCreate( IndexBody,  BodyPos, BodySize, BodyAng, HeadColor )
    holoCreate( IndexHead, HeadPos, HeadSize, HeadAng, HandColor )
    
    holoModel( IndexHead, "sphere", 0 )
 
    #something about balls
    
    BallIndex = -1
    CurrentLength = 0
}
else
{
    OwnerOrigin = entity():owner():shootPos()
    ToOwnerBearing = entity():bearing( OwnerOrigin )
    
    BodyAng = ang( 0, -ToOwnerBearing, 0 )
    HeadAng = ang( 0, -ToOwnerBearing, 0 )
    
    ToOwnerElevation = elevation( HandPos, ang( 0, 0, 0 ), OwnerOrigin )
    FromHandToHeadBearing = bearing( HandPos, ang( 0, 0, 0 ), OwnerOrigin )
    HandAngles = ang( -(ToOwnerElevation - 90), -ToOwnerBearing, 0 )
    
    holoAng( IndexBody, ang( 0, -ToOwnerBearing, 0 ) )
    holoAng( IndexHead, ang( 0, -ToOwnerBearing, 0 ) )
    holoAng( IndexHand, HandAngles )
    
    HandNewPos = ChipPos + vec( HandFromBody * sin( FromHandToHeadBearing ), HandFromBody * cos( FromHandToHeadBearing ), HandTop )
    
    holoPos( IndexHand, HandNewPos )
    
    LenFromBallToTarget = (OwnerOrigin - HandNewPos):length()
    
    if( entity():owner():lastSaid() == "!shoot" && chatClk() && BallIndex == -1 && LenFromBallToTarget < 550 )
    {
        BallIndex = createTheBall( OwnerOrigin, HandNewPos )
        LenFromBallToTarget = (OwnerOrigin - HandNewPos):length()
        OldWeaponPos = HandNewPos
        OldWeaponAngles = HandAngles
        OldVictimPos = OwnerOrigin
        
        CurrentLength = 0
    }
    
    if( BallIndex >= 4 && CurrentLength < LenFromBallToTarget )
    {
        holoPos( BallIndex, OldWeaponPos + vec( CurrentLength * cos(OldWeaponAngles:yaw()), CurrentLength * sin(OldWeaponAngles:yaw()), CurrentLength * cos(OldWeaponAngles:pitch())) )
        CurrentLength = Clock*Acceleration
        
        Clock += 10
    }
    else
    {
        holoDelete( BallIndex )
        
        OldWeraponPos = vec( 0, 0, 0 )
        OldWeaponAngles = ang( 0, 0, 0 )
        OldVictimPos = vec( 0, 0, 0 )
        
        BallIndex = -1
        CurrentLength = 0
        Clock = 0
    }
}

Comments