Вопрос How Do invert scope ?

Участник
Статус
Оффлайн
Регистрация
18 Фев 2020
Сообщения
396
Реакции[?]
153
Поинты[?]
61K
Код:
var cnt = 0
UI.AddSliderFloat("Length", 0, 100)
UI.AddSliderFloat("Speed", 0, 10)
UI.AddColorPicker("Crosshair Color")
UI.AddCheckbox("Rainbow Crosshair")
function rotateAroundPoint(center,point,angle){
    angle = angle / 180 * Math.PI
    var x = Math.cos(angle) * (point[0]-center[0])-Math.sin(angle)*(point[1]-center[1])+center[0]
    var y = Math.sin(angle) * (point[0]-center[0])+Math.cos(angle)*(point[1]-center[1])+center[1]
    return [x,y]
}
function hsv2rgb(h, s, v) {
    var r, g, b, i, f, p, q, t;
    if (arguments.length === 1) {
        s = h.s, v = h.v, h = h.h;
    }
    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);
    switch (i % 6) {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }
    return {
        r: Math.round(r * 255),
        g: Math.round(g * 255),
        b: Math.round(b * 255)
    };
}
function draw(){
    var scr = Render.GetScreenSize()
    scr[0]/=2
    scr[1]/=2
 
    var col = UI.GetColor("Script Items", "Crosshair Color")
    if(UI.GetValue("Script Items", "Rainbow Crosshair")){
        var coll = hsv2rgb(cnt * .002,1,1)
        col = [coll.r,coll.g,coll.b,col[3]]
    }
    var range = UI.GetValue("Script Items", "Length")
    // top
    var topx = scr[0]
    var topy = scr[1]+range
    var topxx = scr[0]-range
    var topyy = scr[1]+range
    var topp = rotateAroundPoint(scr,[topx,topy], cnt)
    var toppp = rotateAroundPoint(scr,[topxx,topyy], cnt)
    Render.Line(scr[0],scr[1],topp[0],topp[1],col)
    Render.Line(topp[0],topp[1],toppp[0],toppp[1],col)
    // bottom
    var botx = scr[0]
    var boty = scr[1]-range
    var botxx = scr[0]+range
    var botyy = scr[1]-range
    var bott = rotateAroundPoint(scr,[botx,boty], cnt)
    var bottt = rotateAroundPoint(scr,[botxx,botyy],cnt)
    Render.Line(scr[0],scr[1],bott[0],bott[1],col)
    Render.Line(bott[0],bott[1],bottt[0],bottt[1],col)
    // right
    var rightx = scr[0]+range
    var righty = scr[1]
    var rightxx = scr[0]+range
    var rightyy = scr[1]+range
    var rightt = rotateAroundPoint(scr,[rightx,righty],cnt)
    var righttt = rotateAroundPoint(scr,[rightxx,rightyy],cnt)
    Render.Line(scr[0],scr[1],rightt[0],rightt[1],col)
    Render.Line(rightt[0],rightt[1],righttt[0],righttt[1],col)
    // left
    var leftx = scr[0]-range
    var lefty = scr[1]
    var leftxx = scr[0]-range
    var leftyy = scr[1]-range
    var leftt = rotateAroundPoint(scr,[leftx,lefty],cnt)
    var lefttt = rotateAroundPoint(scr,[leftxx,leftyy],cnt)
    Render.Line(scr[0],scr[1],leftt[0],leftt[1],col)
    Render.Line(leftt[0],leftt[1],lefttt[0],lefttt[1],col)
    cnt+= Globals.Frametime() * (UI.GetValue("Script Items", "Speed")*100)
}
Cheat.RegisterCallback("Draw","draw")
 
Начинающий
Статус
Оффлайн
Регистрация
15 Дек 2021
Сообщения
5
Реакции[?]
0
Поинты[?]
0
Код:
var cnt = 0
UI.AddSliderFloat("Length", 0, 100)
UI.AddSliderFloat("Speed", 0, 10)
UI.AddColorPicker("Crosshair Color")
UI.AddCheckbox("Rainbow Crosshair")
function rotateAroundPoint(center,point,angle){
    angle = angle / 180 * Math.PI
    var x = Math.cos(angle) * (point[0]-center[0])-Math.sin(angle)*(point[1]-center[1])+center[0]
    var y = Math.sin(angle) * (point[0]-center[0])+Math.cos(angle)*(point[1]-center[1])+center[1]
    return [x,y]
}
function hsv2rgb(h, s, v) {
    var r, g, b, i, f, p, q, t;
    if (arguments.length === 1) {
        s = h.s, v = h.v, h = h.h;
    }
    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);
    switch (i % 6) {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }
    return {
        r: Math.round(r * 255),
        g: Math.round(g * 255),
        b: Math.round(b * 255)
    };
}
function draw(){
    var scr = Render.GetScreenSize()
    scr[0]/=2
    scr[1]/=2

    var col = UI.GetColor("Script Items", "Crosshair Color")
    if(UI.GetValue("Script Items", "Rainbow Crosshair")){
        var coll = hsv2rgb(cnt * .002,1,1)
        col = [coll.r,coll.g,coll.b,col[3]]
    }
    var range = UI.GetValue("Script Items", "Length")
    // top
    var topx = scr[0]
    var topy = scr[1]+range
    var topxx = scr[0]-range
    var topyy = scr[1]+range
    var topp = rotateAroundPoint(scr,[topx,topy], cnt)
    var toppp = rotateAroundPoint(scr,[topxx,topyy], cnt)
    Render.Line(scr[0],scr[1],topp[0],topp[1],col)
    Render.Line(topp[0],topp[1],toppp[0],toppp[1],col)
    // bottom
    var botx = scr[0]
    var boty = scr[1]-range
    var botxx = scr[0]+range
    var botyy = scr[1]-range
    var bott = rotateAroundPoint(scr,[botx,boty], cnt)
    var bottt = rotateAroundPoint(scr,[botxx,botyy],cnt)
    Render.Line(scr[0],scr[1],bott[0],bott[1],col)
    Render.Line(bott[0],bott[1],bottt[0],bottt[1],col)
    // right
    var rightx = scr[0]+range
    var righty = scr[1]
    var rightxx = scr[0]+range
    var rightyy = scr[1]+range
    var rightt = rotateAroundPoint(scr,[rightx,righty],cnt)
    var righttt = rotateAroundPoint(scr,[rightxx,rightyy],cnt)
    Render.Line(scr[0],scr[1],rightt[0],rightt[1],col)
    Render.Line(rightt[0],rightt[1],righttt[0],righttt[1],col)
    // left
    var leftx = scr[0]-range
    var lefty = scr[1]
    var leftxx = scr[0]-range
    var leftyy = scr[1]-range
    var leftt = rotateAroundPoint(scr,[leftx,lefty],cnt)
    var lefttt = rotateAroundPoint(scr,[leftxx,leftyy],cnt)
    Render.Line(scr[0],scr[1],leftt[0],leftt[1],col)
    Render.Line(leftt[0],leftt[1],lefttt[0],lefttt[1],col)
    cnt+= Globals.Frametime() * (UI.GetValue("Script Items", "Speed")*100)
}
Cheat.RegisterCallback("Draw","draw")
thanks bro
 
Начинающий
Статус
Оффлайн
Регистрация
15 Дек 2021
Сообщения
5
Реакции[?]
0
Поинты[?]
0
Код:
var cnt = 0
UI.AddSliderFloat("Length", 0, 100)
UI.AddSliderFloat("Speed", 0, 10)
UI.AddColorPicker("Crosshair Color")
UI.AddCheckbox("Rainbow Crosshair")
function rotateAroundPoint(center,point,angle){
    angle = angle / 180 * Math.PI
    var x = Math.cos(angle) * (point[0]-center[0])-Math.sin(angle)*(point[1]-center[1])+center[0]
    var y = Math.sin(angle) * (point[0]-center[0])+Math.cos(angle)*(point[1]-center[1])+center[1]
    return [x,y]
}
function hsv2rgb(h, s, v) {
    var r, g, b, i, f, p, q, t;
    if (arguments.length === 1) {
        s = h.s, v = h.v, h = h.h;
    }
    i = Math.floor(h * 6);
    f = h * 6 - i;
    p = v * (1 - s);
    q = v * (1 - f * s);
    t = v * (1 - (1 - f) * s);
    switch (i % 6) {
        case 0: r = v, g = t, b = p; break;
        case 1: r = q, g = v, b = p; break;
        case 2: r = p, g = v, b = t; break;
        case 3: r = p, g = q, b = v; break;
        case 4: r = t, g = p, b = v; break;
        case 5: r = v, g = p, b = q; break;
    }
    return {
        r: Math.round(r * 255),
        g: Math.round(g * 255),
        b: Math.round(b * 255)
    };
}
function draw(){
    var scr = Render.GetScreenSize()
    scr[0]/=2
    scr[1]/=2

    var col = UI.GetColor("Script Items", "Crosshair Color")
    if(UI.GetValue("Script Items", "Rainbow Crosshair")){
        var coll = hsv2rgb(cnt * .002,1,1)
        col = [coll.r,coll.g,coll.b,col[3]]
    }
    var range = UI.GetValue("Script Items", "Length")
    // top
    var topx = scr[0]
    var topy = scr[1]+range
    var topxx = scr[0]-range
    var topyy = scr[1]+range
    var topp = rotateAroundPoint(scr,[topx,topy], cnt)
    var toppp = rotateAroundPoint(scr,[topxx,topyy], cnt)
    Render.Line(scr[0],scr[1],topp[0],topp[1],col)
    Render.Line(topp[0],topp[1],toppp[0],toppp[1],col)
    // bottom
    var botx = scr[0]
    var boty = scr[1]-range
    var botxx = scr[0]+range
    var botyy = scr[1]-range
    var bott = rotateAroundPoint(scr,[botx,boty], cnt)
    var bottt = rotateAroundPoint(scr,[botxx,botyy],cnt)
    Render.Line(scr[0],scr[1],bott[0],bott[1],col)
    Render.Line(bott[0],bott[1],bottt[0],bottt[1],col)
    // right
    var rightx = scr[0]+range
    var righty = scr[1]
    var rightxx = scr[0]+range
    var rightyy = scr[1]+range
    var rightt = rotateAroundPoint(scr,[rightx,righty],cnt)
    var righttt = rotateAroundPoint(scr,[rightxx,rightyy],cnt)
    Render.Line(scr[0],scr[1],rightt[0],rightt[1],col)
    Render.Line(rightt[0],rightt[1],righttt[0],righttt[1],col)
    // left
    var leftx = scr[0]-range
    var lefty = scr[1]
    var leftxx = scr[0]-range
    var leftyy = scr[1]-range
    var leftt = rotateAroundPoint(scr,[leftx,lefty],cnt)
    var lefttt = rotateAroundPoint(scr,[leftxx,leftyy],cnt)
    Render.Line(scr[0],scr[1],leftt[0],leftt[1],col)
    Render.Line(leftt[0],leftt[1],lefttt[0],lefttt[1],col)
    cnt+= Globals.Frametime() * (UI.GetValue("Script Items", "Speed")*100)
}
Cheat.RegisterCallback("Draw","draw")
its not working
 
Участник
Статус
Оффлайн
Регистрация
18 Фев 2020
Сообщения
396
Реакции[?]
153
Поинты[?]
61K
C++:
local m_bIsScoped = se.get_netvar("DT_CSPlayer", "m_bIsScoped")
local Scope = false
local offset = ui.add_slider_int("Offset", "offset_scope", 0, 500, 10)
local length = ui.add_slider_int("Length", "length_scope", 0, 1000, 60)
local anim_speed = ui.add_slider_int("Animation speed", "anim_speed_scope", 1, 30, 15)
local animoffset = ui.add_check_box("Animate offset", "animoffset_scope", false)
local col_1 = ui.add_color_edit("First color", "scope_color1", true, color_t.new(255, 255, 255, 255))
local col_2 = ui.add_color_edit("Second color", "scope_color2", true, color_t.new(255, 255, 255, 10))
local anim_num = 0
local lerp = function(a, b, t)
    return a + (b - a) * t
end
client.register_callback("frame_stage_notify", function(s)
    if s ~= 5 then return end
    local local_player = entitylist:get_local_player()
    local bIsScoped = local_player:get_prop_bool(se.get_netvar("DT_CSPlayer", "m_bIsScoped"))
    local_player:set_prop_int(m_bIsScoped, bIsScoped and 1 or 0)
    Scope = bIsScoped and true or false
    if local_player:get_prop_int(m_bIsScoped) then
        local_player:set_prop_int(m_bIsScoped, 0)
    end
end)
client.register_callback("paint", function()
    local local_player = entitylist:get_local_player()
    local screen = engine.get_screen_size()
    local start_x, start_y = screen.x /2, screen.y /2
    local offsett = offset:get_value()
    local lengthh = length:get_value() * anim_num
    local width = 1
    local col1 = col_1:get_value() col1.a = col1.a * anim_num
    local col2 = col_2:get_value() col2.a = col2.a * anim_num
    local animcond = Scope and local_player:is_alive()
    anim_num = lerp(anim_num, animcond and 1 or 0, anim_speed:get_value() * globalvars.get_frame_time())
    offsett = animoffset:get_value() and offsett * anim_num or offsett
    --left
    renderer.rect_filled_fade(vec2_t.new(start_x - offsett + 1, start_y), vec2_t.new(start_x - offsett - lengthh + 1, start_y + width), col1, col2, col2, col1)
    --right
    renderer.rect_filled_fade(vec2_t.new(start_x + offsett, start_y), vec2_t.new(start_x + offsett + lengthh, start_y + width), col1, col2, col2, col1)
    --down
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y + offsett), vec2_t.new(start_x + width, start_y + offsett + lengthh), col1, col1, col2, col2)
    --up
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y - offsett + 1), vec2_t.new(start_x + width, start_y - offsett - lengthh + 1), col1, col1, col2, col2)
end)
 
Последнее редактирование:
Начинающий
Статус
Оффлайн
Регистрация
15 Дек 2021
Сообщения
5
Реакции[?]
0
Поинты[?]
0
C++:
local m_bIsScoped = se.get_netvar("DT_CSPlayer", "m_bIsScoped")
local Scope = false
local offset = ui.add_slider_int("Offset", "offset_scope", 0, 500, 10)
local length = ui.add_slider_int("Length", "length_scope", 0, 1000, 60)
local anim_speed = ui.add_slider_int("Animation speed", "anim_speed_scope", 1, 30, 15)
local animoffset = ui.add_check_box("Animate offset", "animoffset_scope", false)
local col_1 = ui.add_color_edit("First color", "scope_color1", true, color_t.new(255, 255, 255, 255))
local col_2 = ui.add_color_edit("Second color", "scope_color2", true, color_t.new(255, 255, 255, 10))
local anim_num = 0
local lerp = function(a, b, t)
    return a + (b - a) * t
end
client.register_callback("frame_stage_notify", function(s)
    if s ~= 5 then return end
    local local_player = entitylist:get_local_player()
    local bIsScoped = local_player:get_prop_bool(se.get_netvar("DT_CSPlayer", "m_bIsScoped"))
    local_player:set_prop_int(m_bIsScoped, bIsScoped and 1 or 0)
    Scope = bIsScoped and true or false
    if local_player:get_prop_int(m_bIsScoped) then
        local_player:set_prop_int(m_bIsScoped, 0)
    end
end)
client.register_callback("paint", function()
    local local_player = entitylist:get_local_player()
    local screen = engine.get_screen_size()
    local start_x, start_y = screen.x /2, screen.y /2
    local offsett = offset:get_value()
    local lengthh = length:get_value() * anim_num
    local width = 1
    local col1 = col_1:get_value() col1.a = col1.a * anim_num
    local col2 = col_2:get_value() col2.a = col2.a * anim_num
    local animcond = Scope and local_player:is_alive()
    anim_num = lerp(anim_num, animcond and 1 or 0, anim_speed:get_value() * globalvars.get_frame_time())
    offsett = animoffset:get_value() and offsett * anim_num or offsett
    --left
    renderer.rect_filled_fade(vec2_t.new(start_x - offsett + 1, start_y), vec2_t.new(start_x - offsett - lengthh + 1, start_y + width), col1, col2, col2, col1)
    --right
    renderer.rect_filled_fade(vec2_t.new(start_x + offsett, start_y), vec2_t.new(start_x + offsett + lengthh, start_y + width), col1, col2, col2, col1)
    --down
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y + offsett), vec2_t.new(start_x + width, start_y + offsett + lengthh), col1, col1, col2, col2)
    --up
    renderer.rect_filled_fade(vec2_t.new(start_x, start_y - offsett + 1), vec2_t.new(start_x + width, start_y - offsett - lengthh + 1), col1, col1, col2, col2)
end)
thanks all working bro
 
Сверху Снизу