Jump to content

Tails

Members
  • Posts

    731
  • Joined

  • Days Won

    10

Posts posted by Tails

  1. @MGO_SA @Magiz0r @Reda_Iq @CarCrasher @Woffi1221 @Lt.Price @MoHaRx @Marinovv @DreaM40BG

    I pushed a small update to Cinema Experience (version 2.3) on March 20th, 2024. This is mostly a release to fix some long standing issues. The changes include:

    • Fixed video playback issues with auto click through and ad skipping
    • Improved screen resolution from 360p to 1080p
    • Smoothed ambilight color transitions
    • Unlocked Audio Toggle and Change View settings
    • Added screen aspect ratio adjustment in settings
    • Added YouTube Shorts support (.com browser only)
    • Minor UI and texture updates
    • Fixed hud compatibility issue
    • Fixed some multiplayer sync issues

    A couple of new features added as well: onscreen video start messages, and the ability to Change View to look directly at the screen. I also cleaned up some unused settings and code.

    Note that if YouTube TV acts up, you can try enabling the embed video fallback by setting useEmbeds=true in shared.lua. This may cause some videos to error out though due to an embedding issue which is unfixable.

    You can download the updated version here. Let me know if you run into any other issues. Enjoy!

    • Like 3
  2. 20 hours ago, MTA.Castiel said:

    - Bad argument @ 'getElementType' [Expected element at argument 1, got number '30']

    Because @FLUSHBICEPS made a tiny mistake. The event doesn't return the player, it returns the damage the vehicle took. 

    What you need to do instead, is use the getVehicleOccupant function to get the player.

    See https://wiki.multitheftauto.com/wiki/OnVehicleDamage for more info and an example.

  3. I think what you're looking for is a continuous list

    addEventHandler( "onClientKey", root, function(b, state)
            if b == "arrow_u" and state then
                table.insert(skinTable, 1, table.remove(skinTable))
                playSoundFrontEnd(1)
            elseif b == "arrow_d" and state then
                table.insert(skinTable, table.remove(skinTable, 1))
                playSoundFrontEnd(1)
            end
    end)

     

    local x,y = 0, 0
    local sx, sy = guiGetScreenSize()
    
    
    local maxShownItems = 7
    local selectedItem = 4 --use middle item as the current selected item
    
    addEventHandler("onClientRender", root, function()
        for i=1, maxShownItems do
            local xy = (i)*55
    
            -- draw rectangle behind text
            dxDrawRectangle(x, y+xy, 200, 50, tocolor(0, 0, 0, 125))
    
            if i == 4 then
                -- selected item
                dxDrawRectangle(x, y+xy, 200, 50, tocolor(255, 0, 0, 125))
                dxDrawText(" "..skinTable[i].name.."  "..skinTable[i].price.."$", x, y+xy, x+200, y+xy+50, tocolor(255, 255, 255, 255), 1.5, 'default', 'center', 'center', false, false, true, true)
            else
                -- the other items
                dxDrawText(" "..skinTable[i].name.."  "..skinTable[i].price.."$", x, y+xy, x+200, y+xy+50, tocolor(255, 255, 255, 255), 1, 'default', 'center', 'center', false, false, true, true)
            end
        end
    end)

    EvBd2tC.png

    This is pretty standard for these types of lists (ignore the styling)

    • Thanks 1
  4. Hi Snow-Man,

     

    Just do something like this:

    local startIndex = 1
    local maxShownItems = 3
    
    addEventHandler('onClientRender', root, function()
        for i=startIndex, startIndex+maxShownItems do
            local y = (i-startIndex)*20
            dxDrawText(skinTable[i].name, 0, y, 100, 100)
        end
    end)

    And then add or subtract 1 to the startIndex on a key press

    addEventHandler('onClientKey', root, function(key, p)
        if key == 'arrow_u' and p then
            if startIndex > 1 then
                startIndex = startIndex - 1
            end
        elseif key == 'arrow_d' and p then
            if startIndex+maxShownItems < #skinTable then
                startIndex = startIndex + 1
            end
        end
    end)

    Hope this helps.

  5. Yes with dxDrawText and onClientRender event (see: https://wiki.multitheftauto.com/wiki/DxDrawText)

    local sw, sh = guiGetScreenSize()
    addEventHandler('onClientRender', root, function()
      dxDrawText('hello', 0, sh-25, sw, sh+25, tocolor(255, 255, 255, 150), 1, 'default', 'right', 'top', false, false, true)
    end)

    I think this should work. You may have to play around with the x,y,rightx,bottomx values to get it right though, I just wrote this off the top off my head.

  6. You have to shut down your server safely with ctrl+c in windows, or shutdown command in the server console. 

    If the server is stopped abruptly, onResourceStop will not be triggered!

    To avoid losing data in the instance your server crashes, I highly recommend saving important player data such as money every time you update something.

  7. Definitely first one. I would format it like this though, with the start of the function on the same line. It's the common way of writing it because you'll have less indentation.

    addEventHandler("onClientGUIClick", window, function(button, state)
        if button ~= "left" then return end
    
        if source == btnClose then
            return closeMenu()
        end
    
        if source == btnChange then
            local AmountKey = guiGetText(EditKey)
    
            if AmountKey == "" then
                return outputChatBox("error", 255, 25, 25, true)
            end
    
            if string.len(AmountKey) ~= 16 then
                return outputChatBox("error", 255, 25, 25, true)
            end
                    
            outputChatBox("successful", 255,126,0, true)
            closeMenu()
        end
    end)

    Good luck!

    • Like 1
  8. On 16/08/2022 at 13:01, JAY.ANN said:

    It's pretty comfortable to use standard MTA accounts databases but does it have performance issues as setElementData or smth?

    SetElementData is data stored on the player temporarely, if the player logs off, or the server shuts down, you will lose that information. It is stored inside GTA memory and is synced with all players and the server unless specified otherwise.

    SetAccountData only allow you to insert key/value pairs into a fixed db. You have no real control over it, and with lots of data this could be bad for performance because it'd need to do a lot of queries (via getAccountData) for each key/value pair that you saved to a player account.

    MySQL allows you to structure your database and gives you control over what you put in your database and how you modify and query the data. You can also access the data from other places like a website. This will give you the best optimization.

    If you're new or uncomfortable with MySQL you could try using SQLite instead, which creates a new .db file for you which you gives you similar control over it as MySQL except that you don't have a address from which you can access it. I recommend this if you're new and want to try out MySQL for the first time. You don't have to install MySQL to your desktop or server with this option.

    You can use setAccountData for small gamemodes if you don't need to store a ton of data per user, otherwise use MySQL or SQLite.

     

    Hope this helps.

     

    • Thanks 1
  9. You can simply keep track of the ids by adding them to a table and then check against that table to see if it's already seen that id.

    local ids = {}
    for i,v in ipairs(getElementsByType("blips")) do
        local id = getBlipIcon(v)
        if not ids[id] then
            ids[id] = true
            outputChatBox("ID Icon : "..id)
        end
    end
    ids = {} -- clear it if necessary (depends on your application)

    You'll probably want to put this inside a function so that you can trigger it again later, or have the function return the unique ids. But this all depends on the application.

    • Thanks 1
  10. My guess is it's because it's not really player related, unlike with triggerClientEvent you can specifically target a player (in the 1st parameter) that's why there's a oop method.

    Also, you should avoid passing the local player by argument or source as the wiki states, you should use the global client variable on the serverside instead that will be available within every event handler.

    Read the warning here: https://wiki.multitheftauto.com/wiki/TriggerServerEvent

×
×
  • Create New...