Jump to content

Tactical hud compas mta dayz mode (Help scripts)


nqs

Recommended Posts

hi, I have a small problem, how to correctly implement the compass script?

 

Quote

 

sWidth, sHeight = guiGetScreenSize()
 
function checkData(dataName, oldValue)
    if dataName == "debugType" then
        debugType = getElementData(localPlayer,"debugType")
        if debugType == "debugview1" then
            addEventHandler ( "onClientRender", getRootElement(), debug1 )
        elseif debugType == "debugview2" then
            addEventHandler ( "onClientRender", getRootElement(), debug2 )
        elseif debugType == "debugview3" then
            addEventHandler ( "onClientRender", getRootElement(), debug3 )
        elseif debugType == "debugview4" then
            addEventHandler ( "onClientRender", getRootElement(), debug4 )
        end
    elseif dataName == "iconType" then
        iconType = getElementData(localPlayer,"iconType")
        if iconType == "iconview0" then
            removeEventHandler ( "onClientRender", getRootElement(), icon1 )
        elseif oldValue == "iconview0" then
            addEventHandler ( "onClientRender", getRootElement(), icon1 )
        end
    end
end
addEventHandler ( "onClientElementDataChange", localPlayer, checkData)
 
local top = 30
 
local font1 = dxCreateFont("font.otf", 11)
local font2 = dxCreateFont("font.otf", 10)
 
local cords = {
    {0, "N"},
    {15, 15},
    {30, 30},
    {45, "NE"},
    {60, 60},
    {75, 75},
    {90, "E"},
    {105, 105},
    {120, 120},
    {135, "SE"},
    {150, 150},
    {165, 165},
    {170, "S"},
    {195, 195},
    {210, 210},
    {225, "SW"},
    {240, 240},
    {255, 255},
    {270, "W"},
    {285, 285},
    {300, 300},
    {315, "NW"},
    {330, 330},
    {345, 345}
}
 
function compas()
    if getElementData(localPlayer,"compType") == "compview1" and isLogin then
        local show = 15
        local center = math.ceil(show / 2) - 1
        local _, _, r = getElementRotation(getCamera())
        local pos = math.floor(r / 15)
        local slotwidth = 40
        local smooth = ((r - (pos * 15)) / 15) * slotwidth
        local left = sWidth / 2 - ((show + 2) * slotwidth)/2
        for i=1, show do
            local id = i + pos - center
            if(id > #cords)then
                id = id - #cords
            end
            if(id <= 0)then
                id = #cords - math.abs(id)
            end
            if(cords[id])then
                local alpha = (tonumber(cords[id][2]) or 0 > 0) and 175 or 255
                if(i < center)then
                    alpha = alpha * (i/center)
                end
                if(i > center)then
                    alpha = alpha * ((show-i)/center)
                end
                dxDrawRectangle(left + slotwidth * i - smooth + (slotwidth / 2 - 1) + 1, top + 10 + 1, 2, 10, tocolor(0, 0, 0, alpha * 0.5))
                dxDrawRectangle(left + slotwidth * i - smooth + (slotwidth / 2 - 1), top + 10, 2, 10, tocolor(255, 255, 255, alpha))
                dxDrawText(cords[id][2], left + slotwidth * i - smooth + 1, top + 20, left + slotwidth * (i+1) - smooth + 2, top + 40, tocolor(0, 0, 0, alpha * 0.5), 1, font2, "center", "center")
                dxDrawText(cords[id][2], left + slotwidth * i - smooth, top + 20, left + slotwidth * (i+1) - smooth, top + 40, tocolor(255, 255, 255, alpha), 1, font2, "center", "center")
            end
        end
        dxDrawText("➤", left + 4, top + 26 + 2, left + ((show + 3) * slotwidth) + 30, 0, tocolor(0, 0, 0, 160), 1, font1, "center", "top", false, false, false, false, false, 90)
        dxDrawText("➤", left, top + 26, left + ((show + 3) * slotwidth) + 30, 0, tocolor(255, 255, 255, 255), 1, font1, "center", "top", false, false, false, false, false, 90)
    end
end
addEventHandler("onClientRender", getRootElement(), compas)
 
checkData("debugType")
checkData("iconType")

 

please help me, I’m new to this business, I don’t understand at all what is needed here, it doesn’t work for me
who can correctly write a tactical compass script for the DayZ mod

 

How come this project has such a compass

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...