VaporZ

Members
  • Content Count

    126
  • Joined

  • Last visited

Community Reputation

5 Neutral

About VaporZ

  • Rank
    Poot-butt

Recent Profile Visitors

129 profile views
  1. Yet another question, how to fix this weird ugly clamp, etc.: [click] (minimap on left-bottom corner). I am using this code: [click].
  2. Ok, im trying right now with another render target.
  3. Code: 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ć rot = true --Obrót minimapki } 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 } addEventHandler("onClientResourceStart", resourceRoot, function() setPlayerHudComponentVisible("radar", false) minimap = dxCreateRenderTarget(hud.szer, hud.szer, true) full = dxCreateRenderTarget(hud.szer + 5, hud.szer + 5, true) 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 if deweloper[1] then outputChatBox(tostring(x) .. ", " .. tostring(y)) end dxSetRenderTarget(minimap, false) dxSetBlendMode("blend") local zeroX = 1314 local zeroY = 1322 local mapX = x + zeroX + 15 local mapY = y + zeroY local zoneX, zoneY, zoneZ = getElementPosition(localPlayer) 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(0, 0, hud.wiel, hud.wiel, mapX, mapY, hud.wiel, hud.wiel, pliki.int, 0, 0, 0, tocolor(255, 255, 255, hud.przez), "nil") end if deweloper[3] then outputChatBox(tostring(getElementInterior(localPlayer))) end dxDrawImage(hud.szer / 2, hud.szer / 2, 20, 20, pliki.gracz, 180 + rz, 0, 0, tocolor(255, 255, 255, hud.przez)) dxSetRenderTarget(full, false) if hud.rot then dxDrawImage(1, h - hud.szer - 1, hud.szer, hud.szer, minimap, rz) else dxDrawImage(1, h - hud.szer - 1, hud.szer, hud.szer, minimap) dxDrawRectangle(0, h - hud.szer - 5, hud.szer + 5, 5, tocolor(0, 0, 0, hud.przez)) dxDrawRectangle(hud.szer, h - hud.szer, 5, hud.szer, tocolor(0, 0, 0, hud.przez)) end dxSetRenderTarget() dxDrawImage(0, h - hud.szer, hud.szer + 5, hud.szer + 5, full) dxDrawRectangle(0, h - hud.szer, 170, 20, tocolor(0, 0, 0, hud.przez)) if isElementOutSide(localPlayer) then dxDrawText(getZoneName(zoneX, zoneY, zoneZ), 5, h - hud.szer + 2, 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, 0, 0, tocolor(255, 255, 0, hud.przez), 1.0, 1.0, "default-bold"--[[, "left", "top", false, false, false, false, false, rz]]) end dxSetTextureEdge(minimap, "border", tocolor(0, 0, 0, hud.przez)) 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) Output is nothing.
  4. I mean, I have render target, and dxDraw widgets in it. And so, how can I hide parts of widgets, which are apart from edges of render target? Look at this: [click].
  5. Nope I've already managed it to work successfully, but thank you for recommendation!
  6. Maybe I asked in wrong way, maybe yes, maybe no. But the point is, that the image I am rendering has set 0, 0 pos into left upper corner, not in the middle of it. So maybe I need to set center of image, but I don't know how.
  7. I mean, how do I can show exact image section, that player is standing on in the real world now, using dxDrawImageSection()? Like, when mini map is in size of 3000px by 3000px, how to show exact same pos, that local player is on? I tried a lot with: local x, y = getElementPosition(localPlayer) local x = (x * hud.width) / 3000 local y = (y * hud.height) / 3000 --Rest of code or hud.units = 3000 / 6000 local x, y = getElementPosition(localPlayer) local x = x * hud.units local y = y * hud.units --Rest of code (I even tried with just): lo local x, y = getElementPosition(localPlayer) --Rest of code But I guess, that I'm showing w r o n g image section. How can I fix it, or make it better? I tried to understand others' code, but I couldn't. So, I'm writing my, but still, I need some help. So how can I fix something? BTW, if someone want to see full code, please, visit here: [click, Code v2]. And if you will manage something, please, share it with me, I want to learn how to do something correctly.
  8. K, that helped. I didnt knew about it :O
  9. Code: pliki = { mapa = "files/colormap.png" } hud = { szer = 320, przez = 200 } addEventHandler("onClientResourceStart", resourceRoot, function() setPlayerHudComponentVisible("radar", false) minimap = dxCreateRenderTarget(hud.szer, hud.szer, true) end) addEventHandler("onClientResourceStop", resourceRoot, function() setPlayerHudComponentVisible("radar", true) end) addEventHandler("onClientRender", root, function() local x, y, z = getElementPosition(localPlayer) local r = getScreenRotationFromWorldPosition(x, y, z) dxSetRenderTarget(minimap, false) dxSetBlendMode("modulate_add") dxDrawImageSection(0, 0, 3000, 3000, x, y, 3000, 3000, pliki.mapa) dxSetRenderTarget() end) Output: NONE Why?
  10. Nah, miss click. But why it doesn't render dxDrawImageSection()
  11. Well, I have another question, skipping previous, why this don't rendering target? pliki = { mapa = "files/colormap.png" } hud = { szer = 320, przez = 200 } addEventHandler("onClientResourceStart", resourceRoot, function() setPlayerHudComponentVisible("radar", false) image = dxCreateRenderTarget(hud.szer, hud.szer, true) end) addEventHandler("onClientResourceStop", resourceRoot, function() setPlayerHudComponentVisible("radar", true) destroyElement(image) end) addEventHandler("onClientRender", root, function() local x, y, z = getElementPosition(localPlayer) local r = getScreenRotationFromWorldPosition(x, y, z) dxSetRenderTarget(image) -dxSetBlendMode("blend") dxDrawImageSection(9, 24, 3000, 3000, x, y, 3000, 3000, pliki.mapa) end)
  12. Ok, but look at this at logic side: local x, y, z = getElementPosition(localPlayer) local mult = 320 / 6000 local sx = x * mult --Example: 16 (x) * 0.05 (320 / 6000) = 0.8 local sy = y * mult --Isn't that same as: local sx = (x * 320) / 6000 --Example: 16 (x) * 0.05 (320 / 6000) = 0.8 local sy = (y * 320) / 6000 If you still not see the similarity, look: (16 * 320) / 6000 is pretty the same as 16 * (320 / 6000)
  13. Look at this, perhaps ur right: pliki = { mapa = "files/colormap.png", gracz = "files/playerblip.png" } hud = { szer = 320, przez = 200 } addEventHandler("onClientResourceStart", resourceRoot, function() setPlayerHudComponentVisible("radar", false) end) addEventHandler("onClientResourceStop", resourceRoot, function() setPlayerHudComponentVisible("radar", true) end) addEventHandler("onClientRender", root, function() local w, h = guiGetScreenSize() local x, y, z = getElementPosition(localPlayer) local mult = 320 / 6000 local sX = x * mult local sY = y * mult local r = getScreenRotationFromWorldPosition(x, y, z) dxDrawImageSection(9, 24, hud.szer, hud.szer, sX, sY, hud.szer, hud.szer, pliki.mapa, r--[[ - 72]], 0, 0, tocolor(255, 255, 255, hud.przez)) end) Results are negative, for my expectations.