-
Автор темы
- #1
credits: ya god nick
JavaScript:
function GrenadeWarning()
{
var font1 = Render.GetFont("Calibrib.ttf", 25, true);
var font2 = Render.GetFont("Verdanab.ttf", 10, true);
var DistanceInFeet = function(origin, destination) {
var sub = [destination[0] - origin[0], destination[1] - origin[1], destination[2] - origin[2]];
return Math.round(Math.sqrt(sub[0] ** 2 + sub[1] ** 2 + sub[2] ** 2) / 12);
}
GrenadePrediction.Run();
var lp = Entity.GetLocalPlayer;
var origin = Entity.GetRenderOrigin(lp());
var grenades = GrenadePrediction.GetLiveGrenades();
for (var i in grenades)
{
var g = grenades[i];
var destination = g.Position;
var distance = DistanceInFeet(origin, destination);
var screen = Render.WorldToScreen(destination);
if (distance > 150)
{
continue;
}
function Clamp(num, min, max) {
return num <= min ? min : num >= max ? max : num;
}
if (!g.IsLive)
continue;
function draw_arc1(a,n,o,r,t,h,M,c){M=360/M;for(var e=t;e<t+h;e+=M){var s=e*Math.PI/180,P=(e+M)*Math.PI/180,d=Math.cos(s),i=Math.sin(s),f=Math.cos(P),g=Math.sin(P),l=a+d*r,v=n+i*r,y=a+d*o,I=n+i*o,R=a+f*r,u=n+g*r,w=a+f*o,_=n+g*o;Render.Polygon([[y,I],[w,_],[l,v]],c),Render.Polygon([[l,v],[w,_],[R,u]],c)}};
Render.FilledCircle(screen[0], screen[1] -50, 30, [Math.max(0, 255 - Math.pow(distance, 1.7)), 0, 0, 255])
draw_arc1(screen[0]-1, screen[1] - 50, 31, 29, 270, 360, 30, [10, 10, 10, 255]);
Render.String(screen[0], screen[1] - 68, 1, "!", [255, 250, 20, 200], font1);
Render.String(screen[0], screen[1] - 45, 1, distance + " ft", [232, 232, 232, 200], font2);
if (g.Type == "Molotov") {
time = Entity.GetProp(g.EntityIndex, "CInferno", "m_nFireEffectTickBegin") * Globals.TickInterval();
factor = Clamp(((time + 7) - Globals.Curtime()) / 7, 0, 7);
draw_arc1(screen[0]-1, screen[1] - 50, 31, 29, 270, 360 * factor, 150, [232, 232, 232, 200]);
}
}
}
Cheat.RegisterCallback("Draw", "GrenadeWarning");
Последнее редактирование: