function getElementSpeed(theElement, unit) -- Check arguments for errors assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") local elementType = getElementType(theElement) assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")") assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)") -- Default to m/s if no unit specified and 'ignore' argument type if the string contains a number unit = unit == nil and 0 or ((not tonumber(unit)) and unit or tonumber(unit)) -- Setup our multiplier to convert the velocity to the specified unit local mult = (unit == 0 or unit == "m/s") and 50 or ((unit == 1 or unit == "km/h") and 180 or 111.84681456) -- Return the speed by calculating the length of the velocity vector, after converting the velocity to the specified unit return (Vector3(getElementVelocity(theElement)) * mult).length end function isElementOutSide(elem) if elem then if getElementInterior(elem) == 0 then return true else return false end else return false end end pliki = { mapa = "files/map.png", --Domyślna tekstura mapy gracz = "files/player.png" --Domyślna tekstura gracza } hud = { szer = 320, --Długość i wysokość radaru, tego nie zmieniamy pod żadnym pozorem przez = 200, --Przeźroczystość unit = 3000 / 6000, --Unity, radzę nie zmieniać wiel = 320, --Wielkość mapy, też radzę nie zmieniać ratio = 3/2 } ustawienia = { dispHud = true, --Wyświatlaj mapę current_minimap = 2 --Obecna tekstóra minimapy } deweloper = { false, --Opcja dewelopera #1 false, --Opcja dewelopera #2 false --Opcja dewelopera #3 } --I think below this comment u should search up for problems addEventHandler("onClientResourceStart", resourceRoot, function() setPlayerHudComponentVisible("radar", false) minimap = dxCreateRenderTarget(hud.szer, hud.szer) full = dxCreateRenderTarget(hud.szer, hud.szer) end) addEventHandler("onClientResourceStop", resourceRoot, function() setPlayerHudComponentVisible("radar", true) end) addEventHandler("onClientRender", root, function() if ustawienia.dispHud then local w, h = guiGetScreenSize() local x, y, z = getElementPosition(localPlayer) local rx, ry, rz = getElementRotation(localPlayer) local x = x * hud.unit local y = y * hud.unit local zeroX = 1314 local zeroY = 1322 local mapX = x + zeroX + 15 local mapY = y + zeroY local zoneX, zoneY, zoneZ = getElementPosition(localPlayer) if deweloper[1] then outputChatBox(tostring(x) .. ", " .. tostring(y)) end dxSetRenderTarget(minimap, false) dxSetBlendMode("blend") if isElementOutSide(localPlayer) then dxDrawImageSection(0, 0, hud.wiel, hud.wiel, mapX, mapY, hud.wiel, hud.wiel, pliki.mapa, 0, 0, 0, tocolor(255, 255, 255, hud.przez)) else dxDrawImageSection() end if deweloper[3] then outputChatBox(tostring(getElementInterior(localPlayer))) end --if isElementOutSide(localPlayer) then dxDrawImage(hud.szer / 2, hud.szer / 2, 20, 20, pliki.gracz, 180 + rz, 0, 0, tocolor(255, 255, 255, hud.przez)) --else --dxDrawImage(hud.szer / 2, hud.szer / 2, 20, 20, pliki.gracz, 0, 0, 0, tocolor(255, 255, 255, hud.przez)) --end dxSetRenderTarget(full, false) dxSetBlendMode("blend") if isElementOutSide(localPlayer) then dxDrawImage(0, 0, hud.szer, hud.szer, minimap, rz) else dxDrawImage(0, 0, hud.szer, hud.szer, minimap) end dxSetRenderTarget() dxDrawImage(0, h - (hud.szer / hud.ratio), hud.szer, hud.szer / hud.ratio, full) dxDrawRectangle(0, h - (hud.szer / hud.ratio), 170, 20, tocolor(0, 0, 0, hud.przez)) if isElementOutSide(localPlayer) then dxDrawText(getZoneName(zoneX, zoneY, zoneZ), 5, h - ((hud.szer / hud.ratio) - 4), 0, 0, tocolor(255, 255, 255, hud.przez), 1.0, 1.0, "default"--[[, "left", "top", false, false, false, false, false, rz]]) else dxDrawText("Interior number " .. tostring(getElementInterior(localPlayer)), 5, h - ((hud.szer / hud.ratio) - 4), 0, 0, tocolor(255, 255, 0, hud.przez), 1.0, 1.0, "default-bold"--[[, "left", "top", false, false, false, false, false, rz]]) end end end) bindKey("n", "down", function() if isPlayerHudComponentVisible("radar") then setPlayerHudComponentVisible("radar", false) ustawienia.dispHud = true else setPlayerHudComponentVisible("radar", true) ustawienia.dispHud = false end end)