• Content Count

  • Joined

  • Last visited

  • Days Won


IIYAMA last won the day on June 15

IIYAMA had the most liked content!

Community Reputation

714 MTA Ambassador


  • Rank
  • Birthday 01/01/2016


  • Gang
  • Location
  • Occupation
    I have never been to the streets of SA... so who knows?
  • Interests
    Design, scripting, UX/UI

Recent Profile Visitors

7,489 profile views
  1. @JeViCo There is nothing written on that file yet, not until the 🐃 is finished. That poor creature needs a toilet and fast. https://wiki.multitheftauto.com/wiki/FileFlush
  2. Agree, didn't thought about that one, but the counting up loop would still have the issue of skipping one(or more > context) of the items for that frame. The loop doesn't take into account that the index should stop increasing when an item is removed, as the array is collapsing. Would this not cover all the issues? local i = 1 repeat if a[ i ] == func then table.remove( a, i ) else i = i + 1 end until not a[ i ]

    [TUT] Scaling DX

    Cold you explain to me, for which user interfaces/layout that method works well? I can understand that in case of text+box or gridlayout you want to give it a bit more space, but for a button would you use the X axis as well or rather the scaling method? (Both from that topic)

    marker bug

    Yes, understood. So use the solution I gave you for now.
  5. For those who haven't seen it yet. There is since yesterday a tutorial available about scaling DX components on the tutorial section.



    This tutorial can also be user for other types of user interfaces, like the MTA GUI or DX libraries.




    marker bug

    Use this function to check if the marker is visible to the player: https://wiki.multitheftauto.com/wiki/IsElementVisibleTo But why the marker hit event is still triggering in the first place, is even a mystery to me. Note: this is the tutorial section.
  7. [TUT] Scaling DX The reason why I am creating this topic, is because there are a lot of people asking this question: And to be honest there is no best practice for. But here you have my recommendation as guidance for display them the ~s~a~m~e~ for all screen formats. There are two important factors while dealing with screen formats 1. Pixel density Indication: PPI(Pixels Per Inch) and some also use the term DPI(Dots Per Inch) They do not have to be the same while talking about printing stuff. This indication tells us about how many pixels are used per inch. Which more or less tells us how sharp/smooth things like text can be looking. PPI doesn't really play a big role, but to display something nicely you need enough pixels to display it. Else it will be either too small or too crispy. So be careful to not scale things (especially text) too small. 2. Display aspect ratio Wiki The difference between resolution X and resolution Y as a ratio. A list of common ratios: 4:3 5:4 3:2 16:10 16:9 So for example if we take: fHD: 1920x1080 Which has the ratio 16:9 that is calculated like this: 1920 / 16 = 120 120 * 9 = 1080 Scaling without ratio Before I am going to explain any of this, I am going to ask you an important question: Like this: (vertical) ▮ Or horizontal? ▅ I assume most people would agree to play MTA horizontal, else you are probably reading a book or document. p.s If you play MTA on a vertical screen, then we developers do not like you at all, sorry. So what does this tell us? You can assume that the X-resolution is never going to be smaller than the Y-resolution. Useful? You will figure it out. Doing the scaling Note: This part is ABOUT SCALING and not positioning. So what we are going to do is: Calculating a scale which can display the same DX on multiple screen formats Without messing with the ration. Example: A computer runs MTA at a resolution of 1920 x 1080. Lets define that! local devScreenX = 1920 local devScreenY = 1080 If this code is used by a different pc, we also need to know on which resolution it is running: local screenX, screenY = guiGetScreenSize() For the next step we have to look at this screenshot: I have cut out of the wide-screen format a square. Squares have the ratio 1:1, which means that we have removed our ratio difference from this screen resolution. It is very easy to do, as our Y * Y resolution makes exactly that beautiful square! The next thing we have to do is creating our scaling value. This value is required for adjust our resolution values so that they match to every screen format. So to use our ratio 1:1, we use the Y resolution to achieve that: local scaleValue = screenY / devScreenY And as last we can create a rectangle shape that is displayed at the center of every screen format, perfectly! local devScreenX = 1920 local devScreenY = 1080 local screenX, screenY = guiGetScreenSize() local scaleValue = screenY / devScreenY addEventHandler("onClientRender", root, function () -- create a scaled size local sizeX = scaleValue * 300 -- 300px local sizeY = scaleValue * 50 -- 50px -- get the center of the screen local centerX = screenX / 2 local centerY = screenY / 2 -- calculate the starting point of the rectangle local startRectangleX = centerX - (sizeX / 2) local startRectangleY = centerY - (sizeY / 2) dxDrawRectangle ( startRectangleX, startRectangleY, sizeX, sizeY, tocolor ( 255, 255, 255, 255 ) ) end) Lower limit What if we have a resolution of 800x600? And the text is getting too small? Making sure that the pixel density is OK, is very important. So to counter that we have to make sure that the text is not getting too small. Our development Y resolution is 1080 pixels. And we are dealing with an Y resolution 600 pixels. The first thing we are going to look at, is what the scale is going to be at that point. 600 / 1080 = 0.55555555555555555555555555555556 It is not very nice to have your text scaled to 55.5% of the original size, when having low resolution already. But without scaling, the DX stuff might fill up the entire screen and that is just as bad. So what we now need is a limit, in this case a lower limit. scaleValue = math.max(scaleValue, 0.65) The math.max function returns the highest value of all the arguments you put in to it. In this case it contains the: scaleValue: 0.555 And the lower limit of: 0.65 This will make sure that the DX stuff is not getting smaller than 65%. This might make text read able for a 800x600 resolution.
  8. How about you scale over the Y axis only? That solved all my problems. Because in most cases scaling shouldn't include the ration, but the pixel density only. (With some exceptions)


    Those sites do not provide an API. You need that to not receiver their website junk. Instead you want clean JSON or XML! Search on Google for: free timezone api And pick the one that works best for you.
  10. Confusing Did you use this function perhaps? https://wiki.multitheftauto.com/wiki/DxSetAspectRatioAdjustmentEnabled Or did you not refresh the resource properly? Is the box at the right position? dxDrawRectangle (MiniMap_x, MiniMap_y, MiniMap["width"], MiniMap["height"]) Does the rendertarget actually capture the blips? (disable line 28 temporary) Where are the blips now located when the rendertarget doesn't capture?
  11. I do not know what you are doing or have done.
  12. Render them at the top + left corner instead of the bottom + left corner. That shouldn't be a problem, it is your code after all.
  13. The rendertarget will capture the image from the LEFT + TOP corner of the screen. As it is now, it will not be recorded within the rendertarget.
  14. addBlip(52, -1940.97986, 568.07715, "Bank", tocolor(255,255,255,255)) * Where on your screen? * local blipX = math.max(MiniMap_x, math.min(MiniMap_x+MiniMap["width"], blipX)) local blipY = math.max(MiniMap_y, math.min(MiniMap_y+MiniMap["height"], blipY))
  15. IIYAMA

    [Help] Camera

    By editing the offset values of this function: https://wiki.multitheftauto.com/wiki/AttachElements