/**
* converted by by r9x
*
*/
var traceContainer = [];
function tracer(eyepos, hitpos, time) {
this.eyepos = eyepos
this.position = hitpos
this.time = time
}
var impact = 0;
function onBulletImpact() {
if (Globals.Tickcount() > impact) {
if (Entity.GetEntityFromUserID(Event.GetInt("userid")) == Entity.GetLocalPlayer()) {
var x = Event.GetFloat("x")
var y = Event.GetFloat("y")
var z = Event.GetFloat("z")
var pos = [x, y, z]
var view = Entity.GetEyePosition(Entity.GetLocalPlayer());
traceContainer.push(new tracer(view, pos, Globals.Tickcount()))
impact = Globals.Tickcount()
}
}
}
function onDraw() {
if (0) {
traceContainer = [];
return
}
var t = UI.GetValue("Script items", "Ticks Cross last")
var col = UI.GetColor("Script items", "Local Cross color")
for (i in traceContainer) {
//Cheat.Print("lol")
var ss = Render.GetScreenSize()
var view2s = Render.WorldToScreen(traceContainer[i].eyepos)
var pos2s = Render.WorldToScreen(traceContainer[i].position)
if (1) {
/*
this is what i did to check for w2s throwing garbage invalid numbers
not sure why it considers -20k valid but whatever
all this check does it check if the number given is too far out of the bounds of the screen size to make sense
the +- 1000 is because small overflows are ok and still end up rendering properly you can probably do more/less
but i figured that this much looks ok
as im writing this i think i thought of a better way but this is sufficient until i feel like trying it
*/
if (1) {
currenteye = Entity.GetEyePosition(Entity.GetLocalPlayer())
//pasted from google : )
var dx = currenteye[0] - traceContainer[i].eyepos[0];
var dy = currenteye[1] - traceContainer[i].eyepos[1];
var dz = currenteye[2] - traceContainer[i].eyepos[2];
var dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
if (1) {
//Center main line
Render.Line(pos2s[0]+7, pos2s[1], pos2s[0]-7, pos2s[1], col)
Render.Line(pos2s[0], pos2s[1]+7, pos2s[0], pos2s[1]-7, col)
Render.Line(pos2s[0]+6, pos2s[1]+1, pos2s[0]-6, pos2s[1]+1, col)
Render.Line(pos2s[0]+1, pos2s[1]+6, pos2s[0]+1, pos2s[1]-6, col)
Render.Line(pos2s[0]+6, pos2s[1]-1, pos2s[0]-6, pos2s[1]-1, col)
Render.Line(pos2s[0]-1, pos2s[1]+6, pos2s[0]-1, pos2s[1]-6, col)
if (UI.GetValue("Script items", "Local Cross type") == 1) {
//+1 on width
Render.Line(view2s[0] + 1, view2s[1], pos2s[0] + 1, pos2s[1], col)
//+1 on height
Render.Line(view2s[0], view2s[1] + 1, pos2s[0], pos2s[1] + 1, col)
//-1 on width
Render.Line(view2s[0] - 1, view2s[1], pos2s[0] - 1, pos2s[1], col)
//-1 on height
Render.Line(view2s[0], view2s[1] - 1, pos2s[0], pos2s[1] - 1, col)
}
}
}
}
if (traceContainer[i].time + t < Globals.Tickcount()) {
traceContainer.shift()
}
if (UI.GetValue("Script items", "Max Cross") < traceContainer.length) {
traceContainer.shift()
}
}
}
UI.AddDropdown("Local Cross type", ["Thin", "Thick"], 0)
UI.AddColorPicker("Local Cross color")
UI.AddSliderInt("Ticks Cross last", 1, 640)
UI.AddSliderInt("Max Cross", 1, 50)
Cheat.RegisterCallback("Draw", "onDraw")
Cheat.RegisterCallback("bullet_impact", "onBulletImpact")