@name FailCake The Most Evil Cube
@inputs Ee:entity
@outputs Mouse Hop OwnerB Freeze Normal On Pitch R Melon
@persist Timer Attack Pos:vector V:vector Skin
@trigger all

if(first()){On = 0 Pitch = 150 Help = 0}

interval(1)
runOnChat(1)
E = entity()

Skin += 1
if(Skin == 70){
R = randint(1,5)
E:setSkin(R)  
}
if(Skin >= 100){Skin= 0}

Command = owner():lastSaid():lower()
if((Command:explode(" "):string(1) == "-on")&On != 1){
hint("On",100)
On = 1
}
if((Command:explode(" "):string(1) == "-off")&On != 0){
hint("Off",100)
On = 0
}

if(On){
Command = owner():lastSaid():lower()
if((Command:explode(" "):string(1) == "-melon")&Melon != 1){
hint("Melon RAGE",100)
Melon = 1
}
if((Command:explode(" "):string(1) == "-music150")&Pitch != 150){
Pitch = 150
hint("Pitch = "+Pitch,100)
}
if((Command:explode(" "):string(1) == "-music180")&Pitch != 180){
Pitch = 180
hint("Pitch = "+Pitch,100)
}

if((Command:explode(" "):string(1) == "-music250")&Pitch != 250){
Pitch = 250
hint("Pitch = "+Pitch,100)
}

if((Command:explode(" "):string(1) == "-mouse")&Mouse != 1){
hint("Mouse Mode",100)
Mouse = 1
Hop=0
OwnerB = 0
Freeze = 0
Normal = 0
}

if((Command:explode(" "):string(1) == "-hop")&Hop != 1){
hint("Hope Mode",100)
Mouse = 0
Hop = 1
OwnerB = 0
Freeze = 0
Normal = 1

} 

if((Command:explode(" "):string(1) == "-cake")&OwnerB != 1){
hint("Coming Back =D",100)
Mouse = 0
Hop = 0
OwnerB = 1
Freeze = 0
Normal = 0
} 

if((Command:explode(" "):string(1) == "-freeze")&Freeze != 1){
hint("Freezed",100)
Mouse = 0
Hop = 0
OwnerB = 0
Freeze = 1
Normal = 0
} 

if((Command:explode(" "):string(1) == "-normal")&Normal != 1){
hint("Normal Mode",100)
Mouse = 0
Hop = 0
OwnerB = 0
Freeze = 0
Normal = 1
} 


if(Freeze){
Gravity=vec(0,0,0)
Ee:applyForce((Gravity-E:vel()/400)*Ee:mass())
}

if(Normal){
Gravity=vec(0,0,9.015+9.015)

Ee:applyForce((Gravity-Ee:vel()/400)*Ee:mass())
}


if(Mouse){
Ee:applyForce((owner():aimPos()-Ee:vel())*Ee:mass())   
}


R1 = randint(0,255)
R2 = randint(0,255)
R3 = randint(0,255)

holoCreate(1)
holoModel(1,"cube")
holoPos(1,Ee:pos())
holoScale(1,vec(Ee:boxSize():x(),Ee:boxSize():y(),Ee:boxSize():z())/12)
holoAng(1,Ee:angles())
holoParent(1,Ee)
holoColor(1,vec(R1,R2,R3))
holoMaterial(1,"models/debug/debugwhite")


if(Hop){
findIncludeClass("player")
findInSphere(holoEntity(1):pos(),15)
F=find()

Pos=(F:pos() - Ee:pos())

if(F){
Ee:applyForce(Pos + $Pos)
soundStop(100000)
soundStop(200000)
Timer = 0
Ee:setMass(500)
Freeze = 1
}else{
Freeze = 0
Ee:setMass(1)
}

}

if(OwnerB){
V=(owner():pos() - Ee:pos() + vec(0,0,140))
Ee:applyForce(V + $V*30)
}


if(Melon){

    findByClass("prop_physics")
    findIncludeModel("models/props_junk/watermelon01.mdl")
    P=findClosest(E:pos())

Pos = (P:pos() - E:pos())
if(P){
Ee:applyForce((Pos*20 + $Pos*20)*E:mass())
}
else{}
Ee:setMass(25)

Dist = Ee:pos():distance(P:pos())

if(Dist<50){
        Ee:soundPlay(7331,0,"npc/headcrab_fast/headbite.wav")
}   
}


Timer+=1
if(Timer == 70){
holoEntity(1):soundPlay(100000,100000,"music/HL2_song23_SuitSong3.mp3")
Ee:soundPlay(200000,200000,"music/HL2_song23_SuitSong3.mp3")
}
soundPitch(100000,Pitch)
soundPitch(200000,Pitch)
if(Timer >= 1500){
soundStop(100000)
soundStop(200000)
Timer = 0
}

}else{
soundStop(100000)
soundStop(200000)
Timer = 0
holoDelete(1)
}


##PROTECTION SISTEM MUAHAHAHAH##

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