Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by savour

  1. @arciCZ In that case remove the formFields and replace it with postData (convert the table to json)
  2. Well, in "embeds" you can embed more than one embed, so you have to put it on another table (table per embed) embeds = { { -- This is embed number 1 title = "Hi", description = " S6066 authored & committed", fields={ {name="1",value="2"}, {name="3",value="4"} }, footer = { text = "Woah! So cool! :smirk:", icon_url = "https://i.imgur.com/fKL31aD.jpg" } } }
  3. You can use "INNER JOIN" but you will need to practice it a little bit (columns with the same name will be prefixed with the table name)
  4. Someone told me that he had bugs retrieving the false values from a json table (makes the value nil, which results of removing it from the Lua table). I didn't really test that bug but it should be fine, you can make some work around if you encountered it, not fatal bugs at the end so you are good to go (still, columns or another table are easier)
  5. IIYAMA's answer is the ideal way to handle that, storing items in a separate table, or use add another columns to your existing table. you can still store a whole table at one cell by the way but maybe you will find it a little buggy. you can store the table in a cell as JSON (text) using toJSON(table), and when you retrieve it use fromJSON()
  6. When you poll the query, it returns a table including other tables, each one represents a row, like this: local dbQ = dbQuery(database, "SELECT * FROM `players` WHERE `serial` = ?", player_serial) local dbR = dbPoll(dbQ, -1) -- in this case you're only expecting one row so the player will be dbR[1] serial = dbR[1].serial name = dbR[1].name -- If you're dealing with multiple entries: local dbQ = dbQuery(database, "SELECT * FROM `players`") -- This will result: { {name = "player1", serial="serial1", ...}, {name = "player2", serial="serial2", ...}, -- and so on } About the
  7. It means that it will wait for the results from the database, then continue executing, however, if the function didn't receive any value from the query during the `timeout` it will return nil, then continue the execution. for SQLite, you shouldn't worry about that (since it is on the same server, you almost get an instant response) so an ideal value should be -1 (no timeout) if you are dealing with a well-made database and healthy queries. This function, dbExec, doesn't return any value related to the query, it just executes the query, so you don't need a dbFree. (also, dbFree is
  8. savour

    Discord Python

    Show me the error, and the area where it happens
  9. savour

    Discord Python

    Here you go https://gitlab.com/OwlGamingCommunity/mta-python-sdk
  10. In this case, you need to check to see if any of the two windows are visible, for example: showCursor(guiGetVisible(window1) or guiGetVisible(window2), true) -- or you can make it shorter with oop showCursor(window1.visible or window2.visible, true)
  11. It's totally expected, when you hide the gui at the first time, isCursorShowing will return false after, so when you execute the function again it will show the cursor, as simple as that: not true = false not false = true So, it you only want to hide it, why checking for its visibility showCursor(false, true)
  12. In the first case, the first argument is the player who typed the command, and it's up to you to call it whatever you want. in the second case the source gotta be defined in the parent event/function, also it refers for "which element (player) am i going to trigger this event for?" also, the source is most likely to be hidden, you will find what it refers to when you search about the parent event in the wiki (would be like "The source of this event is ...")
  13. The thing is, marker hits are triggered for a lot of elements (including other markers as well), not just players, so you have to specify that. local respawnMarker = createMarker(2, 0, 2.22, "cylinder", 1.0, 255, 100, 100, 100) function toSpawnIt(player) if source == respawnMarker and getElementType(player) == "player" then spawnPlayer(player, 10, 0, 5) end end addEventHandler("onMarkerHit", resourceRoot, toSpawnIt)
  14. Simple if would do it if getTrainTrack and type(getTrainTrack) == "function" then --... end You can also check if it does exist in the _G table (which contains all global functions provided by mta/Lua)
  15. savour

    "Zoom" camera

    I think Matrix:getForward() with processLineOfSight should do the purpose
  16. Try txd:import(id) --Or EngineTXD.import(txd, id) You need to read a bit about the 'self' argument, maybe you will find it a little confusing; but it make things a lot easier when you get it
  17. well, from what i see here you don't really need the round method math.floor(12345/1000) = 12 math.floor(19999/1000) = 19 math.floor(999/1000) = 0 also for more optimization, avoid using the OOP on render events, since it uses double the resources (from my experience) also you can make some value setters outside the render events (that changes the value after something is happened) and use the final results only on rendering
  18. are you talking about the amount of code or the process itself?
  19. You don't need render events when dealing with cegui, also if you want the user to input anything, you must use an Editbox(you can set its alpha to zero), else you gonna have to learn some DX functions
  20. try this: https://wiki.multitheftauto.com/wiki/SetElementDoubleSided
  21. if you want the vehicle to be immune against fist-punches, try this: addEventHandler("onClientVehicleDamage", root, function(attacker, weapon) if weapon == 0 then cancelEvent() end end )
  22. You may find this useful https://wiki.multitheftauto.com/wiki/ToHex
  23. savour


    Radio buttons will save you a lot of code, cuz in case of checkboxes you will need to check every checkbox ( in case if the player choose more than once ), However, if you want to continue with checkboxes; you gonna use guiCheckBoxGetSelected( checkbox ) and it will return true/false.
  24. https://wiki.multitheftauto.com/wiki/OnClientKey
  25. Hello there, I've been searching for the FileSystem module that is shown here: https://wiki.multitheftauto.com/wiki/Modules/FileSystem Unfortunately, I couldn't find anywhere, also the download links are outdated for both windows and linux, when I deeply traced the links I found the source code for the whole MTA:Eir project, but again, I don't have the right tools and the enough knowledge to extract the tool and recompile it. so if anyone has this piece of module it would be great to re-upload it. Thanks in advance!
  • Create New...