ℓιgнт

Members
  • Content count

    834
  • Joined

  • Last visited

Community Reputation

6 Neutral

About ℓιgнт

  • Rank
    Road Dawg
  • Birthday 12/03/00

Details

  • Gang
    ツ Noob Scripter シ
  • Occupation
    Student
  • Interests
    Never give up!

Recent Profile Visitors

798 profile views
  1. [English]JSeries[Race|RPG|Sandbox]

    I'd definitely come to check it out and I'd gladly bring a few friends along too.
  2. Screenshots Failing, Other Graphical Issues

    Anyone?
  3. DX Comboboxes

    Works, is it possible to make this into an export, so that I can use it multiple times instead of writing the code over and over, for gridlists?
  4. DX Comboboxes

    Thanks
  5. DX Comboboxes

    I fixed that, but thanks, now the problem is that when I click on Skin #1 it works, and says Skin #1, I click Skin #2, and it says '1', then I click the rest, and they dont work.
  6. DX Comboboxes

    local sX, sY = guiGetScreenSize() local contentList = { {"Skin #1", 1}, {"Skin #2", 2}, {"Skin #3", 3}, {"Skin #4", 4}, {"Skin #5", 5} } local boxW, boxH = 200, 30 local boxX, boxY = (sX-boxW)/2, (sY-boxH*#contentList)/2 local selectedItem = -1 local listOpened = false _getCursorPosition = getCursorPosition function getCursorPosition() local cX, cY = _getCursorPosition() if cX and cY then return cX*sX, cY*sY end return -1, -1 end function inBox(x, y, w, h) local cX, cY = getCursorPosition() return (cX > x and cX < x + w and cY > y and cY < y + h) end addEventHandler("onClientRender", getRootElement(), function() dxDrawRectangle(boxX, boxY, boxW, boxH, tocolor(0,0,0,255)) dxDrawText(selectedItem > 0 and contentList[1][selectedItem] or "Select a skin", boxX+20, boxY, boxX+20, boxY+boxH, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center") if listOpened then for i, k in ipairs(contentList) do dxDrawRectangle(boxX, boxY+i*boxH, boxW, boxH, inBox(boxX, boxY+i*boxH, boxW, boxH) and tocolor(255, 0, 0, 170) or tocolor(0, 0, 0, 170)) dxDrawText(k[1], boxX+20, boxY+i*boxH, boxX+20, boxY+(i+1)*boxH, tocolor(255, 255, 255, 255), 1, "default-bold", "left", "center") end end end) addEventHandler("onClientClick", getRootElement(), function() if inBox(boxX, boxY, boxW, boxH) then -- The main one listOpened = true return elseif listOpened then for i, k in ipairs(contentList) do if inBox(boxX, boxY+i*boxH, boxW, boxH) then selectedItem = i listOpened = false return end end end end) showCursor(true) Okay fixed that too, but it started to return different values.
  7. DX Comboboxes

    showCursor(true) local combo = { {"Skin #1", 1}, {"Skin #2", 2}, {"Skin #3", 3}, {"Skin #4", 4}, {"Skin #5", 5} } addEventHandler("onClientRender", root, function() for i, v in pairs(combo) do dxDrawRectangle(525, 336, 214, 31, tocolor(0, 0, 0, 150), false) dxDrawText(v[1], 525, 336, 739, 367, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) end dxDrawRectangle(525, 305, 214, 31, tocolor(0, 0, 0, 255), false) dxDrawText(getElementData(localPlayer, "selected:item") or combo[1][1], 525, 305, 739, 336, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) end ) I've got to here, kind of confused on what to do next?
  8. DX Comboboxes

    How can I make a DX Combobox?
  9. Clicking on stuff in a table

    I mean root works perfectly fine, just getRootElement is the problem, and thanks I'll use resourceRoot too.
  10. Clicking on stuff in a table

    Say if I write in one script e.g. One folder is called - script1 And the other one is called - script2 -- In c.lua in script1 folder I wrote at the end of the function - getRootElement(). So now say if I restart script2 it will also restart script1, and when I change it to root instead of getRootElement(), it works fine, any ideas?
  11. Clicking on stuff in a table

    And last thing, which one is the right one to use in addEventHandler, after the handler, so is it root or getRootElement() ? Because when I use getRootElement() sometimes, and when I start another script, it starts this one too.
  12. Clicking on stuff in a table

    function detectClicks() for i, pos in pairs(t) do if isMouseInPosition(pos[2], pos[3], pos[4], pos[5]) then return outputChatBox(pos[1]) end end end addEventHandler("onClientClick", root, detectClicks) Like that?
  13. Clicking on stuff in a table

    So what I did is right? function detectClicks() for i, pos in pairs(t) do if isMouseInPosition(pos[2], pos[3], pos[4], pos[5]) then outputChatBox(pos[1]) end end end addEventHandler("onClientClick", root, detectClicks)
  14. Clicking on stuff in a table

    Yes, and thank you so much, I was kind of confused on something, you see the detect clicks part, how would I know which text is being pressed? Would I do something like outputChatBox(pos[1]) I don't get that part, how do I only get a certain text that is clicked.
  15. Clicking on stuff in a table

    local t = { {"First", x, y, w, h}, {"Second", x, y, w, h}, {"Third", x, y, w, h}, {"Fourth", x, y, w, h} } addEventHandler("onClientRender", root, function() for i, v in pairs(t) do dxDrawText(v[1], v[2]+20, v[3], v[4], v[5]) end end) function detectClicks() for k, pos in pairs(t) do if isMouseInPosition(pos[2], pos[3], pos[4], pos[5]) -- end end end addEventHandler("onClientClick", root, detectClicks) function isMouseInPosition ( x, y, width, height ) if ( not isCursorShowing( ) ) then return false end local sx, sy = guiGetScreenSize ( ) local cx, cy = getCursorPosition ( ) local cx, cy = ( cx * sx ), ( cy * sy ) if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then return true else return false end end