Jump to content

The_GTA

Helpers
  • Posts

    816
  • Joined

  • Last visited

  • Days Won

    81

Everything posted by The_GTA

  1. I am happy to hear that! Have fun with this project. I agree. This workflow seems really complicated. Not much I can do about that though on the module's end. We know the steps of adjusting the server configuration and adding the binary. But I hope that people are willing to get into stuff that seems new to them!
  2. Yes, you can read files inside of any resource and adjust the meta.xml files according to rules. Be careful and do not add the same file twice. Also think about removing meta.xml entries whose files do not exist anymore.
  3. I would like to see a modloader that uses the scanDir API instead of the meta.xml. Also a personal webspace on the MTA server for user-submitted mods could be cool.
  4. Hello MTA developers, today I have added the Linux version of the FileSystem 2.0 release. I am sorry for the delay - caused by unnecessaringly technical and motivational factors - but this release is the most stable Linux version yet. It is made possible by directly linking to the deathmatch.so Linux module so that fileSystem.so does use the actual Lua implementations exported by MTA. I was unable to get a LuaRocks version ready because I do not understand how to integrate my custom Code::Blocks build system into it. If there is sufficient interest and straight-forward help I might deliver that too. Wouldn't want to disrespect the hard-effort by qaisjp and co. Only AMD 64bit is supported. Hit me up if you need any other platform. Download it here: https://green-candy.osdn.jp/external/releases/fileSystem_2_0_linux.zip Have fun!
  5. local function invMoveSlots(sinv, sslot, tinv, tslot) if not sslot or not tslot or not sinv or not tinv then return end local selectedSlot1 = sinv.items[sslot] local selectedSlot2 = tinv.items[tslot] sinv.items[sslot] = selectedSlot2 tinv.items[tslot] = selectedSlot1 end local isdragging = false; local draginv = false; local dragslot = false; local slotrender = false; function Inventory:drag(button,state,mouseX,mouseY) if button == 'left' then if state == 'down' then if (isdragging == false) then self.getSlotInfo = {self:getSlot(mouseX,mouseY)} firsSlot = self.getSlotInfo[4] if (firsSlot) then isdragging = true; draginv = self; dragslot = firsSlot; slotrender = self.fSlot; addEventHandler('onClientRender',root,self.fSlot) end end end if state == 'up' then if (isdragging) then self.getSlotInfo = {self:getSlot(mouseX,mouseY)} print(self.getSlotInfo[4]) if (self.getSlotInfo[4]) then invMoveSlots(draginv, dragslot, self, self.getSlotInfo[4]) end removeEventHandler('onClientRender',root,slotrender) isdragging = false; draginv = false; dragslot = false; slotrender = false; end end end end Your system is fundamentally flawed because it does not contain the global inventory list but you are ignoring my messaging so I won't remind you any further.
  6. Definition of the bind function? Actual error message?
  7. Yea so what? What is your fSlot anyway? Are you being serious?
  8. local function invMoveSlots(sinv, sslot, tinv, tslot) if not sslot or not tslot or not sinv or not tinv then return end local selectedSlot1 = sinv.items[sslot] local selectedSlot2 = tinv.items[tslot] sinv.items[sslot] = selectedSlot2 tinv.items[tslot] = selectedSlot1 end local isdragging = false; local draginv = false; local dragslot = false; local slotrender = false; function Inventory:drag(button,state,mouseX,mouseY) if button == 'left' then if state == 'down' then self.getSlotInfo = {self:getSlot(mouseX,mouseY)} firsSlot = self.getSlotInfo[4] if (firsSlot) then isdragging = true; draginv = self; dragslot = firsSlot; slotrender = self.fSlot; addEventHandler('onClientRender',root,self.fSlot) end end if state == 'up' then if (isdragging) then self.getSlotInfo = {self:getSlot(mouseX,mouseY)} print(self.getSlotInfo[4]) if (self.getSlotInfo[4]) then invMoveSlots(draginv, dragslot, self, self.getSlotInfo[4]) end removeEventHandler('onClientRender',root,slotrender) isdragging = false; draginv = false; dragslot = false; slotrender = false; end end end end This is just an example and does not contain the code for cross inventory dragging. You have to implement the list of inventories to do it.
  9. Oh, I remember. How about moveSlots?
  10. I don't see any fundamental design problems in your code. But you seem to have trouble with taking the right parameter to the right place. What does the getSlot method do and how is it defined?
  11. What should work? Can you describe it?
  12. I think that with "clicking" you are not referring to the repeat motion of clicking the mouse button BUT the motion of leaving your finger on the mouse button clicked? You can query this information using the getKeyState function by passing the "mouse1" string to it for the left mouse button, "mouse2" for the right mouse button.
  13. What do you mean? If you execute the on click handler then a click has happened. Please rephrase your question or show details.
  14. Glad to hear that you got it working! You're welcome. Come back if you have any further questions.
  15. Put all inventories into a list, iterate over them in the mouse click handler and check which one has a defined rectangle item slot at the current mouse position. Store the successful inventory in a variable and retrieve it's type field to check which one it is.
  16. local menu_path = { MENU } local function visit_menu(m) table.insert(menu_path, m) end local function get_current_menu() if (#menu_path == 0) then return false end return menu_path[#menu_path] end local function unvisit_current_menu() table.remove(menu_path) end Look at lua-users wiki: Table Library Tutorial
  17. function Inventory:getSlot (x,y) for i = 1, #self.slots do -- table local t = i - 1 local xOffset = self.startX + (t*(self.iconSize + self.padding)) local yOffset = self.startY + (math.floor(t/6)*(self.iconSize + self.padding)) xOffset = xOffset - math.floor(t/6)*(6*(self.iconSize + self.padding)) if isInBox(x,y,xOffset,xOffset + self.iconSize,yOffset,yOffset + self.iconSize) then return i end end return false -- good idea end What is the definition of the isInBox function?
  18. Calculate the rectangles of each slot in the mouse click handler and associate the rectangle with the slot data structures.
  19. Hello Dzsozi (h03), your script appears to be missing the path of menus that you are visiting. The path of menus is defined as a list of menu displays d1...dn where d1 is the initially displayed menu, di is the menu that was selected in menu d(i-1). Then switching back to the previous menu is defined as removing the top-most menu entry dn and setting the menu entry d(n-1) as the current menu display. With that idea in your head, I hope that you can figure out it's implementation. Feel free to ask.
  20. Here: if (result) and (result[1]) then setElementData(source,"id",result[1].id) --I fixed this part setElementModel(source, result[1].skin ) --I fixed this part end
  21. You misunderstand how the SQL language works. To get all rows and columns of accounts SQL table, you execute... SELECT * FROM accounts But if you want just id and skin, you execute... SELECT id, skin FROM accounts Thus I recommend you to change the database query to... local skinData = dbQuery(connection,"SELECT skin,id FROM accounts LIMIT 1")
  22. You're welcome! I believe this algorithm is important to a lot of inventory systems that are slot based.
  23. local skinData = dbQuery(connection,"SELECT * FROM accounts WHERE id=? AND skin=? LIMIT 1",(id),(skin)) What are the definitions of the global variables "id" and "skin"?
  24. local slot = #self.items while (count > 0) and (slot > 0) do if self.items[slot][1] == itemID then local canTake = math.min(count,self.items[slot][2]) self.items[slot][2] = self.items[slot][2] - canTake if self.items[slot][2] == 0 then table.remove(self.items,slot) end count = count - canTake end slot = slot - 1 end if (count > 0) then outputDebugString("not taken entire count"); end slot parameter to Inventory:takeItem has been neglected.
  25. According to your stack definition you can only have 128 on each stack. I recommend you to change your algorithm to take items from multiple stacks until the requested take-count is exhausted. Are you familiar with this idea?
×
×
  • Create New...