-
Автор темы
- #1
JavaScript:
//gui elements
UI.AddSubTab( [ "Visuals","SUBTAB_MGR" ], "Logs" );
var path = [ "Visuals","SUBTAB_MGR","Logs","Logs"];
var colorLogs = UI.AddColorPicker( path, "Color logs" );
var outlineColorLogs = UI.AddColorPicker( path, "Outline color logs" );
var logs = [];
var logsTime = [];
var logsAlpha = [];
var backgroundLogsAlpha = []
var logsMove = [];
var logsWidth = [];
var logsHeight = [];
var shoot = 0;
var hurt = 0;
var missLog = false;
//ragebot info
var target;
var targetHitbox;
var targetName;
function getHitboxName(index)
{
var hitboxName = "";
switch (index)
{
case 0:
hitboxName = "head";
break;
case 1:
hitboxName = "neck";
break;
case 2:
hitboxName = "pelvis";
break;
case 3:
hitboxName = "body";
break;
case 4:
hitboxName = "thorax";
break;
case 5:
hitboxName = "chest";
break;
case 6:
hitboxName = "upper chest";
break;
case 7:
hitboxName = "left thigh";
break;
case 8:
hitboxName = "right thigh";
break;
case 9:
hitboxName = "left calf";
break;
case 10:
hitboxName = "right calf";
break;
case 11:
hitboxName = "left foot";
break;
case 12:
hitboxName = "right foot";
break;
case 13:
hitboxName = "left hand";
break;
case 14:
hitboxName = "right hand";
break;
case 15:
hitboxName = "left upper arm";
break;
case 16:
hitboxName = "left forearm";
break;
case 17:
hitboxName = "Right upper arm";
break;
case 18:
hitboxName = "right forearm";
break;
default:
hitboxName = "none";
}
return hitboxName;
}
function renderLogs()
{
var font = Render.GetFont( "Verdana.ttf", 11, true);
if (logs.length > 8)
{
logs.shift();
logsTime.shift();
logsMove.shift();
logsAlpha.shift();
backgroundLogsAlpha.shift();
logsWidth.shift();
logsHeight.shift();
}
if (logsTime[0] + 7 < Globals.Curtime( ) || !Entity.IsValid( Entity.GetLocalPlayer( ) ))
{
logsAlpha[0] -= Globals.Frametime() * 600;
backgroundLogsAlpha[0] -= Globals.Frametime() * 120;
logsMove[0] -= Globals.Frametime() * 120;
if(logsAlpha[0] < 0)
{
logs.shift();
logsTime.shift();
logsMove.shift();
logsAlpha.shift();
backgroundLogsAlpha.shift();
logsWidth.shift();
logsHeight.shift();
}
}
for(i = 0; i < logs.length; i++)
{
if (logsWidth.length < logs.length)
{
logsWidth.push(Render.TextSize( logs[logs.length - 1], font )[0]);
logsHeight.push(Render.TextSize( logs[logs.length - 1], font )[1]);
}
Render.GradientRect(logsMove[i] - 5, 3 + 21 * i, logsWidth[i], logsHeight[i] + 9, 1, [ 0, 0, 0, backgroundLogsAlpha[i] ], [ 0, 0, 0, 0 ]);
Render.String(logsMove[i] + 1, 6 + 21 * i, 0, logs[i], [UI.GetColor( outlineColorLogs )[0],
UI.GetColor( outlineColorLogs )[1],UI.GetColor( outlineColorLogs )[2],logsAlpha[i]], font);
Render.String(logsMove[i], 5 + 21 * i, 0, logs[i], [UI.GetColor( colorLogs )[0],
UI.GetColor( colorLogs )[1],UI.GetColor( colorLogs )[2],logsAlpha[i]], font);
}
}
function getRagebotInfo()
{
shoot++;
missLog = true;
target = Event.GetInt("target_index");
targetHitbox = Event.GetInt("hitbox");
targetName = Entity.GetName(target);
missLog = false;
}
function addHitLogs()
{
localPlayer = Entity.GetLocalPlayer();
getAttacker = Event.GetInt("attacker");
getDamage = Event.GetInt("dmg_health");
damageRemaining = Event.GetInt("health");
attacker = Entity.GetEntityFromUserID( getAttacker );
if(localPlayer == attacker)
{
logs.push("Registered shot in the " + getHitboxName(targetHitbox) + " of " + targetName + " with a " + getDamage + " damage (" + damageRemaining + " remaining)");
logsTime.push(Globals.Curtime( ));
logsMove.push(5);
logsAlpha.push(255);
backgroundLogsAlpha.push(130);
hurt++;
}
}
function addMissLogs()
{
if(hurt < shoot)
{
shoot = 0;
hurt = 0;
if (!missLog)
{
missLog = true;
logs.push("Missed shot due to unknown");
logsTime.push(Globals.Curtime( ));
logsMove.push(5);
logsAlpha.push(255);
backgroundLogsAlpha.push(130);
}
}
}
function drawList()
{
renderLogs();
addMissLogs();
}
Cheat.RegisterCallback("Draw", "drawList")
Cheat.RegisterCallback("ragebot_fire", "getRagebotInfo")
Cheat.RegisterCallback("player_hurt", "addHitLogs")
Последнее редактирование: