Jump to content

Kazafka

Members
  • Posts

    143
  • Joined

  • Last visited

Everything posted by Kazafka

  1. 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?
  2. Nah, miss click. But why it doesn't render dxDrawImageSection()
  3. 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)
  4. 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)
  5. 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.
  6. Is there any universal way, to convert GTA SA coordinates to pixels? I tried with this: local x, y = getElementPosition(localPlayer) x = (256 * x) / 6000 --(Player's coords times myMinimapWidth) devided by GTASAMaxCoords y = (256 * y) / 6000 --Same as upper's But it's not giving me positive results. Anyone knows the way?
  7. Actually, I'm testing it now, and I can't say, that it's bad, because it's cool, but I need to work more with coords on screen, but anyways, thank you very much.
  8. Case is, that my window is set to not be able to resize. Maybe, it will be better to explain with code: window = guiCreateWindow(27, 472, 308, 198, "", false) guiWindowSetSizable(window, false) img1 = guiCreateStaticImage(9, 24, ustawienia.hud.resx, ustawienia.hud.resy, ustawienia.mapa, false) --Here, all parameters like ustawienia.hud.resx has been set, of course. And maybe it is available to zoom into this image, or e x p a n d it? I want to create something like this https://imgur.com/a/evPJJbh but with CEGUI.
  9. Kazafka

    crashing errors.

    Geez, I tried to help with any idea
  10. Well, how to make static image, and let it be expanded, even, if it has a parent? Any idea, developers?
  11. IM MOOVING INTO ANOTHER SUBJECT WITH OTHER QUESTION
  12. Kazafka

    crashing errors.

    Did u tried to reinstall MTA SA? Did u? Or maybe increase virtual memory for games or try increasing RAM.
  13. I mean, you can do something like this in CEGUI (default GUI in MTA), like, when you create window in width 256 and height 192 (example), and add image in width 600 and height 600, set image parent as earlier created window, this image will crop, etc. Is something like this available in dx GUI? So, yes, it is possible, to set parents of dx widgets (dxDrawImage, dxDrawRectangle, etc.)?
  14. Well, imagine, that you want to create a minimap, not a radar with blips, etc., but only minimap, right? And, you want to zoom it, or show only the part of it, where is player standing right now, on real world. So, you need, to calculate pixels from world position, right?
  15. I meant, to calculate pixels from world positions for 2D images, ex.: dxDrawImage() *as in my prev post (function)
  16. Basically, how can I calculate some pixels from world position, in MTA?
  17. I don't know how Can I do it, so please, give me an example. Or maybe it is like this? triggerEvent(".res_name:onEventTriggeerred") It is right?
  18. Clean-up - Not already done Changed order of scripts - Done Filling arguments - ?Deleted arguments? Still none of effect
  19. META: <meta> <export function="dxDrawTextOnElem" type="server"/> <!----> <script src="cars.Lua" type="server"/> <script src="bank.Lua" type="server"/> <script src="utility.Lua" type="server"/> <script src="utility-c.Lua" type="client"/> <script src="3dmessages.Lua" type="client"/> <script src="testy.Lua" type="server"/> <script src="testy-c.Lua" type="client"/> <script src="rgbpicker/gui.Lua" type="client"/> <!----> <file src="bank/accounts.xml"/> <file src="bank/atms.xml"/> <file src="cars/saved.xml"/> <file src="cars/shops.xml"/> <!----> <info author="VaporZ" name="VaporZ's utility [PL]" description="Utility od VaporZ (po polsku)" type="script" version="1.0.1"/> </meta> GUI.Lua: function rgbClosePicker(button, state) --Funkcja zamykająca wybieranie kolorków, +zwracająca ich wartości (poprzez event "rgbOnColorsPicked", parametry: r (czerwony), g (zielony), b (niebieski)) if(button == "left") and (state == "up") then local pos1 = guiScrollBarGetScrollPosition(scrollbar1) local pos2 = guiScrollBarGetScrollPosition(scrollbar2) local pos3 = guiScrollBarGetScrollPosition(scrollbar3) guiSetVisible(window, false) showCursor(false, false) local red = pos1 local green = pos2 local blue = pos3 local red = red * 255 / 100 local green = green * 255 / 100 local blue = blue * 255 / 100 triggerEvent("rgbOnColorsPicked", resourceRoot, red, green, blue) end end function OnScroll() local pos1 = guiScrollBarGetScrollPosition(scrollbar1) local pos2 = guiScrollBarGetScrollPosition(scrollbar2) local pos3 = guiScrollBarGetScrollPosition(scrollbar3) local red = pos1 local green = pos2 local blue = pos3 local red = red * 255 / 100 local green = green * 255 / 100 local blue = blue * 255 / 100 guiLabelSetColor(label4, red, green, blue) end addEventHandler("onClientResourceStart", resourceRoot, function() --Generowanie interfejsu local screenW, screenH = guiGetScreenSize() window = guiCreateWindow((screenW - 337) / 2, (screenH - 224) / 2, 337, 224, "Wybierz kolor w formacie RGB", false) guiWindowSetSizable(window, false) scrollbar1 = guiCreateScrollBar(9, 29, 318, 15, true, false, window) scrollbar2 = guiCreateScrollBar(10, 79, 317, 15, true, false, window) label1 = guiCreateLabel(123, 54, 93, 15, "R (czerwony)", false, window) guiLabelSetColor(label1, 255, 0, 0) guiLabelSetHorizontalAlign(label1, "center", false) label2 = guiCreateLabel(128, 104, 82, 15, "G (zielony)", false, window) guiLabelSetColor(label2, 0, 255, 0) guiLabelSetHorizontalAlign(label2, "center", false) scrollbar3 = guiCreateScrollBar(10, 129, 317, 15, true, false, window) label3 = guiCreateLabel(123, 154, 93, 18, "B (niebieski)", false, window) guiLabelSetColor(label3, 0, 0, 255) guiLabelSetHorizontalAlign(label3, "center", false) button1 = guiCreateButton(10, 182, 158, 32, "Wybierz", false, window) label4 = guiCreateLabel(179, 186, 148, 22, "Przykładowy tekst", false, window) guiLabelSetHorizontalAlign(label4, "center", false) addEventHandler("onClientGUIClick", button1, rgbClosePicker, false) addEventHandler("onClientGUIScroll",getRootElement(),OnScroll) guiSetVisible(window, false) showCursor(false, false) function rgbOpenPicker(bool) --Funkcja otwierająca wybieranie kolorków guiSetVisible(window, true) showCursor(true, true) end addCommandHandler("rgb", function() rgbOpenPicker() end) end) function rgbToHex(red, green, blue, alpha) --Funkcja formatująca kolor w formacie RGB na kolor w formacie HEX (r, g, b, a --> FFRRGGBBAA) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if alpha then return string.format("FF%.2X%.2X%.2X%.2X", red, green, blue, alpha) else return string.format("FF%.2X%.2X%.2X", red, green, blue) end end TESTY-C.Lua: exports[getResourceName(getThisResource())]:rgbOpenPicker(true) or rgbOpenPicker() addEvent("rgbOnColorsPicked", true) addEventHandler("rgbOnColorsPicked", resourceRoot, function(r, g, b) outputChatBox("Oto te kolorki!", r, g, b) end)
  20. But im trying in one resource: CLIENT-SIDE 1: --Define function function rgbOpenPicker() --GUI magic end CLIENT-SIDE 2: rgbOpenPicker() And dont work. What is wrong then.
  21. So, when I want to call for a function from client-side1.Lua, wich is wrote in other script, like client-side2.Lua I need to do this? Or e x p o r t ?
  22. So, CLIENT-SIDE 1: addEventHandler("onClientResourceStart", resourceRoot, function() --Define function rgbOpenPicker() function rgbOpenPicker() --Do some GUI stuff end end) CLIENT-SIDE 2: addEventHandler("onClientResourceStart", resourceRoot, function() --Define function rgbOpenPicker() function rgbOpenPicker() --Do some GUI stuff end end) rgbOpenPicker() But u know, that I have GUI only in CLIENT-SIDE 1, so doing the same in CLIENT-SIDE 2 with nil values, is weirdo
×
×
  • Create New...