Jump to content


  • Posts

  • Joined

  • Last visited

Deeze's Achievements


Newbie (4/54)



  1. Thank you for the reply! We have played around with what you said, we disabled all our JSON usage, we upgraded from Debian 9.5 to Debian 10.6, we made sure to make a fresh install of the libc package however the crashs persist. We have tried using our same scripts on our old host and everything worked flawless, therefore we concluded that this is neither the fault of MTA, nor of us, but rather of the new host. Again, thank you for helping, we're gonna talk to our new provider and then, if they can't fix it, probably move back to our old host. This thread can be closed.
  2. We're currently working on a server using Debian v9.5.0 Minimal Our server has recently been crashing quite a lot (5 times within a week) and we are unsure why. We recently switched server-provider so we're thinking it might have to do with that, although the only thing that really did change was us going from Debian v9 to v9.5. Dump files: https://upload.mtasa.com/u/371729673/dumps_inside.zip_
  3. Sure thing! "then" in LUA is only used in conjuction with an if-statement. An if-statement works like this: local apples = 5 if (apples == 5) then outputChatBox("I have 5 apples!") outputChatBox("And i really love them!") end As you can see, we simply set a variable called 'apples' to the value of 5 and then, in our if statement, we simply check if the value of apples is equal to 5, and if it is, we execute the code between "then" and "end" (the two outputChatBox function calls). We do not need to write "then" between the two outputChatBox's because that is not how LUA syntax works. You could check the MTA/LUA wiki for better explanation if my explanation wasn't clear enough
  4. Remove the "then" on line 5
  5. Deeze

    Dx Grid

    --Gridlist Class local Gridlist = {} Gridlist.__index = Gridlist --Create a new Gridlist at screenPosition x, y with a given width and displaying visibleRows to the client function Gridlist.new(x, y, width, visibleRows) local self = setmetatable({}, Gridlist) self._startRow = 1 self._selectedRow = 1 self._visibleRows = visibleRows self._rowHeight = 20 self._position = {x = x, y = y} --VisibleRows + 1 because we will display a header self._size = {width = width, height = (1 + visibleRows) * self._rowHeight} self._columns = {} self._rows = {} self._listeners = {} addEventHandler("onClientKey", root, function(button, isPress) if (isPress) then if (button == "arrow_u") then self:setSelectedRowID(self:getSelectedRowID() - 1) elseif (button == "arrow_d") then self:setSelectedRowID(self:getSelectedRowID() + 1) end end end) return self end --Works similar to MTA Event system. function Gridlist:addListener(eventName, callback) if (not self._listeners[eventName]) then self._listeners[eventName] = {} end self._listeners[eventName][#self._listeners[eventName] + 1] = callback end function Gridlist:callListeners(eventName, ...) if (not self._listeners[eventName]) then return false end for i, v in pairs(self._listeners[eventName]) do v(...) end end --Add a new visible column with the given title, width and textAlign function Gridlist:addColumn(title, size, textAlign) self._columns[#self._columns + 1] = {name = title, width = size, align = textAlign} end --Set the ColumnTitle of a given column to the newTitle function Gridlist:setColumnTitle(columnIDOrName, newTitle) --In case we've used a name as ID if (type(columnIDOrName) == "string") then local foundEntry = false --Figure out which actual ID belongs to the column for i, v in pairs(self._columns) do if (v.name == columnIDOrName) then columnIDOrName = i foundEntry = true break end end if (not foundEntry) then outputDebugString("Tried to edit Gridlist Column title, but column was not found!") return false end end self._columns[columnIDOrName].name = newTitle end --Set the selected row ID function Gridlist:setSelectedRowID(ID) if (not self._rows[ID]) then outputDebugString("Tried to edit Gridlist Selected Row ID, but rowID was not found!") return false end self._selectedRow = ID self:callListeners("selectedRowChanged", ID) self:adjustStartRow() end --Adjust start row (for scrolling) function Gridlist:adjustStartRow() if (self._selectedRow > (self._startRow + self._visibleRows - 1)) then self._startRow = self._selectedRow - self._visibleRows + 1 elseif (self._selectedRow < self._startRow) then self._startRow = self._selectedRow end end --Returns currently selected row (id) use gridlist:getRows()[gridlist:getSelectedRowID] to access row directly function Gridlist:getSelectedRowID() return self._selectedRow end --Returns all rows of this gridlist function Gridlist:getRows() return self._rows end --adds a new row to this gridlist, parameters have to fill columns, like normal GUI gridlist function Gridlist:addRow(...) self._rows[#self._rows + 1] = {...} end --Draws the headers of this gridlist function Gridlist:drawHeaders() local x = self._position.x for i,v in pairs(self._columns) do dxDrawText(v.name, x, self._position.y, x + v.width, self._position.y + self._rowHeight, tocolor(255, 255, 255, 255), 1, "default-bold", v.align, "center") x = x + v.width end end --Draws the rows of this gridlist function Gridlist:drawRows() local y = self._position.y + self._rowHeight for i = self._startRow, self._startRow + self._visibleRows - 1, 1 do local row = self._rows[i] if (row) then --Is this the selected row? local textColor = tocolor(255, 255, 255, 255) if (self:getSelectedRowID() == i) then dxDrawRectangle(self._position.x, y, self._size.width, self._rowHeight, tocolor(255, 255, 255, 255)) textColor = tocolor(0, 0, 0, 255) end --Draw it local x = self._position.x for id, text in pairs(row) do local col = self._columns[id] dxDrawText(text, x, y, x + col.width,y + self._rowHeight, textColor, 1, "default-bold", col.align, "center") x = x + col.width end y = y + self._rowHeight end end end --Renders this gridlist function Gridlist:render() --Background dxDrawRectangle(self._position.x, self._position.y, self._size.width, self._size.height, tocolor(0, 0, 0, 200)) self:drawHeaders() self:drawRows() end ------------------------------------------------------------------------------------------ local sX, sY = guiGetScreenSize() local w, elements = 300, 6 --Create a new gridlist at the center of the screen which displays (6) elements with the width of 300 pixels local grid = Gridlist.new(sX * 0.5 - (w * 0.5), sY * 0.5, w, elements) --Add 2 columns, both are 150 pixels wide (300 * 0.5) grid:addColumn("INTERACTION MENU", (w * 0.5), "left") grid:addColumn("0 / 0", (w * 0.5), "right") --Add different rows grid:addRow("QUICK GPS", "None") grid:addRow("Inventory", "") grid:addRow("Action", "Crew: The Bird") grid:addRow("Player Mood", "Normal") grid:addRow("Disable Passive Mode", "") grid:addRow("Highlight Player", "") grid:addRow("Another Option #1", "") grid:addRow("Another Option #2", "") grid:addRow("Another Option #3", "") grid:addRow("Another Option #4", "") grid:addRow("Another Option #5", "") --Update our column title local function newRowSelected(row) grid:setColumnTitle(2, grid:getSelectedRowID() .. "/ " .. #grid:getRows()) end grid:addListener("selectedRowChanged", newRowSelected) grid:setSelectedRowID(1) --Let's draw our gridlist! addEventHandler("onClientRender", root, function() grid:render() end) Here's a small example of how you could do it, obviously this doesn't have all the features you need, but this should work as a base that you can expand on.
  6. Use this: https://wiki.multitheftauto.com/wiki/DxSetAspectRatioAdjustmentEnabled
  7. Example : I'm making a mp3 player script where you can select songs(stored server-side), as soon as you click on a song the mp3 player starts to download it and plays it as soon as its finish downloading. Now let's say all mp3 files are stored in a folder in our mp3 resource. Now, you would have to type in all the mp3 file names in the meta as files, and with about 100+ songs that would be hella work. Now what if i want to access all the mp3 files with a script, but i don't want to put them into the meta, meaning that my script can access them without the mp3 files beeing written in the meta. Is this possible? If yes, how? If no, aww :c
  8. Hey guys, since i allways map my maps with different shades(8558,3458,8558,3458,...) i decided to search a bit for a tool that help's me doing that, since i found none i decided to make my own and release it public. Video: Controls: j+leftclick to add/remove object from group. /change objectmodelid to change the object models of each object in the group. This works with every object i tested so far. /ua to unselect all objects from the group There is no undo function at the moment, i will add one asap. Downloadlinks: Mediafire: http://www.mediafire.com/download/rl80di4535l5wvp/NGT.zip Mta resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=9217 Please report any bugs you find. Suggestions and Feedback would be nice ^.^ Changelog 1.0.1 - Added /ua to unselect all objects from the group 1.0.2 - Fixed a little bug. 1.0.3/4 - Fixed bug that objects wont change Sincerely, nGear
  9. Moved this thread to resources. https://forum.multitheftauto.com/viewtopic.php?f=108&t=75285
  • Create New...