Search the Community
Showing results for tags 'pleasehelp'.
-
So I'm trying to do an inventory script and I'm having a problem with the dxTarget scaling. https://youtu.be/rCihMvRlvBs local screenW, screenH = guiGetScreenSize() local render = dxCreateRenderTarget(screenW * 0.3994, screenH * 0.2652) local cx, cy = (screenW/2) - ((screenW * 0.3994) / 2), (screenH/2) - ((screenH * 0.2652) / 2) local scroll = 0.0000 local scrollV = 0.0255 local maxScroll = 0.0000 local selected = 47 local slots = {} local Color = tocolor(140, 140, 140, 150) local selectedColor = tocolor(0, 200, 255, 200) function dxInv() if render and isElement(render) then showCursor(true) dxDrawRoundedRectangle(screenW * 0.3994, screenH * 0.2652, screenW * 0.2012, screenH * 0.4697, 10, tocolor(0, 0, 0, 80), false) x, y = 0.0050, 0.0040 local load = getElementData(localPlayer, 'inv.mochila') slots = {} dxSetRenderTarget(render, true) for i=1,24 do dxDrawRectangle(screenW * x, screenH * (y - scroll), screenW * 0.0920, screenH * 0.0470, i == selected and selectedColor or Color, false) table.insert(slots, {screenW * x, screenH * (y - scroll), screenW * 0.0920, screenH * 0.0470}) dxDrawImage(screenW * (x + 0.0100), screenH * ((y + 0.0070) - scroll), screenW * 0.0700, screenH * 0.0350, "img/agua.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) x = x + 0.0990 if x >= 0.3850 then x = 0.0050 y = y + 0.0495 end end maxScroll = y - 0.2152 dxSetRenderTarget() dxDrawImage(screenW * 0.3994, screenH * 0.2652, screenW * 0.2012, screenH * 0.4697, render) end end addEventHandler('onClientRender', root, dxInv) function scrollRoller(b, p) if p then if b == 'mouse_wheel_up' then scroll = math.max(0, scroll - scrollV) elseif b == 'mouse_wheel_down' then scroll = math.min(maxScroll, scroll + scrollV) end end end addEventHandler('onClientKey', root, scrollRoller) function clickSelect(b, s) if s == 'down' then if b == 'left' then for i,v in ipairs(slots) do if isMouseInPosition(v[1] + cy, v[2] + cx, v[3], v[4]) then selected = i end end end end end addEventHandler('onClientClick', root, clickSelect)
- 2 replies
-
- help me!
- script help support
-
(and 2 more)
Tagged with: