-
Автор темы
- #1
Привет!
В общем мне захотелось что нибудь спастить и отвлечься от рекода моей джски. И решил переделать паблик хит/мисс лист.SS:
JavaScript:
UI.AddCheckbox("Hit/miss list");
UI.AddSliderInt("hitmis x", 0, Global.GetScreenSize()[0]);
UI.AddSliderInt("hitmis y", 0, Global.GetScreenSize()[1]);
function in_bounds(vec, x, y, x2, y2) {
return (vec[0] > x) && (vec[1] > y) && (vec[0] < x2) && (vec[1] < y2)
}
var gun_fired2 = false;
var font_size = 4;
var shots =
{
fired: 0,
hit: 0,
missed: 0,
hit_chance: 0,
miss_chance: 0
};
function weapon_fire22() {
shots.fired = shots.fired + 1;
gun_fired2 = true;
}
function player_hurt22() {
var attacker_id = Event.GetInt("attacker");
var attacker_weapon = Event.GetString("weapon");
if (Entity.IsLocalPlayer(Entity.GetEntityFromUserID(attacker_id)) && is_gun(attacker_weapon) && gun_fired2) {
shots.hit = shots.hit + 1;
gun_fired2 = false;
}
}
function main22() {
const x = UI.GetValue("Misc", "JAVASCRIPT", "hitmis x") + 10,
y = UI.GetValue("Misc", "JAVASCRIPT", "hitmis y") - 73;
if (Global.GetMapName() == "" || !UI.GetValue("Misc", "JAVASCRIPT", "Hit/miss list"))
return;
shots.missed = shots.fired - shots.hit;
shots.hit_chance = ((shots.hit / shots.fired) * 100);
shots.miss_chance = ((shots.missed / shots.fired) * 100);
shots.total_chance = ((shots.missed + shots.fired));
if (Global.IsKeyPressed(1) && UI.IsMenuOpen()) {
const mouse_pos = Global.GetCursorPosition();
if (in_bounds(mouse_pos, x - 200, y - 200, x + 200, y + 200)) {
UI.SetValue("Misc", "JAVASCRIPT", "hitmis x", mouse_pos[0]);
UI.SetValue("Misc", "JAVASCRIPT", "hitmis y", mouse_pos[1]);
}
}
if (shots.fired <= 0) {
shots.hit_chance = 0;
shots.miss_chance = 0;
shots.total_chance = 0;
}
var font = Render.AddFont("Verdana", 1, 1000);
var font1 = Render.AddFont("VerdanaB", 12, 1000);
var font2 = Render.AddFont("VerdanaB", 9, 1000);
var font3 = Render.AddFont("Verdana", 7, 100);
var font4 = Render.AddFont("Verdana", 9, 100);
text_size = Render.TextSize("total: " + shots.fired, font_size);
Render.FilledRect(x - 10, y + 68, 110, 2, [89, 119, 239, 255]);
Render.FilledRect(x - 10, y + 70, 110, 57, [1, 1, 1, 255]);
Render.StringCustom(x - 7, y + 73, 0, "Chances:", [230, 230, 230, 230], font4);
Render.StringCustom(x - 7, y + (text_size[1] - 13) * 6 - 55, 0, "HITS: " + shots.missed + " (" + Math.round(shots.miss_chance) + "%)", [0, 255, 0, 255], font3); //-55
Render.StringCustom(x - 7, y + (text_size[1] - 13.5) * 6 - 40, 0, "MISSES: " + shots.hit + " (" + Math.round(shots.hit_chance) + "%)", [255, 0, 0, 255], font3); //-40
Render.StringCustom(x - 5.5, y + (text_size[1] - 13.6) * 6 - 27, 0, "TOTAL: " + shots.fired, [255, 153, 0, 255], font3); //-27
}
Global.RegisterCallback("ragebot_fire", "weapon_fire22");
Global.RegisterCallback("player_hurt", "player_hurt22");
Global.RegisterCallback("Draw", "main22");
Последнее редактирование: