@name Minge Killer By TheExecuter and Chaquator
@persist Kill Num Targeted Walk Started
@persist [SIDs]:array
@persist [T]:entity
@persist [Pos O U]:vector
@persist [Ang]:angle
@persist [Model]:string
if(first()){
#Generic things
entity():setTrails(50,0,3,"trails/laser",randvec(0,255),255)
runOnTick(1)
runOnChat(1)
entity():propFreeze(0)
T = owner()
Model = "models/props_phx/ww2bomb.mdl"

#Holos
holoCreate(1)
holoScale(1,vec(1,1,1)) 
holoPos(1,entity():pos())
holoModel(1, "models/props_lab/huladoll.mdl")
holoParent(1,entity())
    
holoCreate(2)
holoModel(2,"models/XQM/Rails/gumball_1.mdl")
holoPos(2,holoEntity(1):pos()+vec(0,25,0))
holoParent(2,holoEntity(1)) 
holoScale(2,vec(0.5,0.5,0.5))    
holoColor(2,vec(255,0,0))    
holoParent(2,1)
holoMaterial(2,"models/props_combine/portalball001_sheet")

holoCreate(3)
holoModel(3,"models/XQM/Rails/gumball_1.mdl")
holoPos(3,holoEntity(1):pos()+vec(25,0,0))
holoParent(3,holoEntity(1)) 
holoScale(3,vec(0.5,0.5,0.5))    
holoColor(3,vec(0,255,0))  
holoParent(3,1)
holoMaterial(3,"models/props_combine/portalball001_sheet")

holoCreate(4)
holoModel(4,"models/XQM/Rails/gumball_1.mdl")
holoPos(4,holoEntity(1):pos()+vec(-25,0,0))
holoParent(4,holoEntity(1)) 
holoScale(4,vec(0.5,0.5,0.5))    
holoColor(4,vec(0,0,255))
holoParent(4,1)
holoMaterial(4,"models/props_combine/portalball001_sheet")

holoCreate(5)
holoModel(5,"models/XQM/Rails/gumball_1.mdl")
holoPos(5,holoEntity(1):pos()+vec(0,-25,0))
holoParent(5,holoEntity(1)) 
holoScale(5,vec(0.5,0.5,0.5))    
holoColor(5,vec(200,0,200))
holoParent(5,1)
holoMaterial(5,"models/props_combine/portalball001_sheet")

holoCreate(6)
holoModel(6,"models/XQM/Rails/gumball_1.mdl")
holoPos(6,holoEntity(1):pos()+vec(0,0,5))
holoParent(6,holoEntity(1)) 
holoScale(6,vec(0.5,0.5,0.5))    
holoParent(6,1)
holoMaterial(6,"models/props_combine/portalball001_sheet")

#Custom Functions
function entity:goto(Vector:vector){
 This:applyForce(((Vector-This:pos())*25-This:vel())*This:mass())   
}
function entity:turnTo(Tarang:angle){
V = This:toLocal(rotationVector(quat(Tarang)/quat(This))+This:pos())
This:applyTorque((100*V - 30*This:angVelVector())*This:inertia()/3)
}

#Anti Theft By Chaquator
SIDs = array("STEAM_0:0:32759932","STEAM_0:0:33994222")
if(!entity():getName():find("TheExecuter")|!entity():getName():find("Chaquator")){
hint("Ahaha credit stealing piece of shit!",3)
selfDestruct()   
}
for(I=1,SIDs:count()){
if(owner():steamID()==SIDs[I,string]){
Valid = 1
break   
}else{
Valid = 0
}
}

if(!Valid){
hint("You're not allowed to have this dupe...",3)
selfDestruct()
}
}

Num+=10+entity():vel():length()/50
holoAng(1,entity():toWorld(ang(0,Num,0)))

if(chatClk(owner())){
S = owner():lastSaid():lower():explode(" ")
if(S[1,string]=="-t"){
hideChat(1)
TT = findPlayerByName(S[2,string])
if(TT:isValid()){
T = TT
hint("Target found "+T:name(),3)   
owner():soundPlay("enemyspotted",1.5,"/radio/ct_enemys.wav")
Targeted = 1
if(T == owner()){
 Targeted = 0
 Kill = 0
 hint("Killing mode disabled off for your safety",3)   
}
}else{
hint("Target not found",3)
}
}

if(S[1,string]=="-kill"){
hideChat(1)
if(Targeted){
Kill = !Kill
hint("Killing mode has been toggled to "+Kill,3)
}else{
hint("You can't use killing mode unless you are targeting someone else other than yourself",3)
}
}
}


if(changed(Kill)){
if(Kill){
timer("kill",1250)
}else{
stoptimer("kill")
}
}

if(Kill){
if(clk("kill")){
stoptimer("kill")
timer("kill",750)
if(T:isAlive()){
B = propSpawn(Model,entity():pos(),1)
B:propNotSolid(1)
B:propBreak()
}
}   
}

if(T:pos():distance(entity():pos())>1){
Walk = 1
Dst = entity():pos():distance(T:pos())/50
O = entity():forward()*clamp(T:pos():distance(entity():pos())/10,10,100)
}else{
Walk = 0
O = entity():forward()*0
}

U = entity():up()*((T:pos():z()+90)-entity():pos():z())/10

Pos = entity():pos()+O+U
Ang = ang(0,(T:pos()-entity():pos()):toAngle():yaw(),0)
entity():goto(Pos)
entity():turnTo(Ang)

if(changed(T:isAlive())){
if(!T:isAlive()){
owner():soundPlay("kill",3,"/radio/enemydown.wav")
Kill = 0
Targeted = 0
T = owner()
}
}

if(duped()|dupefinished()){
 reset()   
}
