brunob22 Posted July 11, 2015 Share Posted July 11, 2015 ola gostira de saber como eu adiciono um scrollbar.. print: codigo: wx, hy = guiGetScreenSize() local x, y = wx/2, hy/2 local globalOff = 0 weight = 0 weightH = 0 itemmoving = 0 slots = 96 slotsH = 120 invLabelsTable = {} dragitem = 0 infoitem = 0 infolabel = nil descrname = false descrtype = "Comida" descr = "Restaura Fome" inventoryShowing = false loot = false --lootname = "Окружение" boxesLabels = {} invWeapLabelsTable = {} colorRED = false colorGREEN = false colorBLUE = false colorORANGE = false -- тут closeInventoryWindowCrest = nil removeWeapsWindowCrest = nil currentAdditWeap = false currentMainWeap = false currentAddClothing = false currentLabelWeapAddit = false function weapFitsInInventory ( curr, new ) local xs, ys = getItemNewSlots ( curr ) or 1, 1 local xs_new, ys_new = getItemNewSlots ( new ) or 1, 1 local finx, finy = xs_new-xs, ys_new-ys if finx < 0 then finx = 0 end if finy < 0 then finy = 0 end if checkSpaceForItem ( finx, finy ) then return true end return false end function getCurrentWeaponImage() local weap = getPedWeapon(getLocalPlayer()) if weap and weap > 0 then if weaponsTable[weap] then return weaponsTable[weap][1],weaponsTable[weap][2],weaponsTable[weap][3] end end return false end function startDraggingItem(key,state,source) if not dragging then dragging = true colorRED = false colorGREEN = false colorBLUE = false colorORANGE = false -- тут draggingMainWeap = false draggingAdditWeap = false if isElement(currentLabelSelf) then local row = getElementData ( currentLabelSelf, "row" ) local column = getElementData ( currentLabelSelf, "column" ) if inv[row][column] > 0 then dragitem = inv[row][column] if inventory[inv[row][column]][10] then draggingAdditWeap = inventory[inv[row][column]][1] end currentLabelOwner = 1 end elseif isElement(currentLabelHim) then local row = getElementData ( currentLabelHim, "row" ) local column = getElementData ( currentLabelHim, "column" ) if invH[row][column] > 0 then dragitem = invH[row][column] if inventoryH[invH[row][column]][9] then draggingMainWeap = true end currentLabelOwner = 2 end elseif isElement(currentLabelWeap) then dragitem = 1 currentLabelOwner = 3 elseif isElement(currentLabelWeapAddit) then dragitem = 1 currentLabelOwner = 4 end if not bindKey ( 'mouse1', 'up', finishDragging ) then bindKey ( 'mouse1', 'up', finishDragging ) end end end function finishDragging () if not dragging then return true end dragging = false if dragitem == 0 then return true end if onBoxItem and isElement ( onBoxItem ) then local id = getElementData ( onBoxItem, "boxLabelID" ) if id then if currentLabelOwner == 2 then return true elseif currentLabelOwner == 1 then local xs, ys = inventory[dragitem][2], inventory[dragitem][3] if inventory[dragitem][8] then xs, ys = 1, 1 end setElementData ( getLocalPlayer(), "fb"..id, inventory[dragitem][1] ) boxesItems[id] = { inventory[dragitem][1], inventory[dragitem][4], xs, ys } elseif currentLabelOwner == 3 then local weap = getItemData (currentMainWeap) local xs, ys = weap[2], weap[3] setElementData ( getLocalPlayer(), "fb"..id, weap[1] ) boxesItems[id] = { weap[1], weap[6], weap[2], weap[3] } elseif currentLabelOwner == 4 then local weap = getItemData (currentAdditWeap) local xs, ys = weap[2], weap[3] setElementData ( getLocalPlayer(), "fb"..id, weap[1] ) boxesItems[id] = { weap[1], weap[6], weap[2], weap[3] } end end dragitem = 0 return true end if onWeaponLabel then if currentLabelOwner == 2 then return true end for i,itemInfo in ipairs(inventoryItems["Weapons"]["Primary Weapon"]) do if inventory[dragitem][1] == itemInfo[1] then currentMainWeap = itemInfo[1] useItems(inventory[dragitem][1],"Pegue a arma principal") setGlobalOff() dragitem = 0 return true end end for i,itemInfo in ipairs(inventoryItems["Weapons"]["Secondary Weapon"]) do if inventory[dragitem][1] == itemInfo[1] then useItems(inventory[dragitem][1],"Pegue armas extra") currentAdditWeap = itemInfo[1] setGlobalOff() dragitem = 0 return true end end for i,itemInfo in ipairs(inventoryItems["Weapons"]["Specially Weapon"]) do if inventory[dragitem][1] == itemInfo[1] then useItems(inventory[dragitem][1],"Pegue armas especiais") dragitem = 0 return true end end for i,itemInfo in ipairs(inventoryItems["Weapons"]["Pistols"]) do if inventory[dragitem][1] == itemInfo[1] then useItems(inventory[dragitem][1],"Pegue armas peças") dragitem = 0 return true end end end if isElement ( currentLabelSelf ) and currentLabelOwner == 2 then -- если перетаскиваем из лута в FERRAMENTAS local csx, csy = 1, 1 if not inventoryH[dragitem][8] then csx, csy = inventoryH[dragitem][2], inventoryH[dragitem][3] end if not draggingMainWeap then if checkSpaceForItem ( csx, csy ) then moveItemInInventory ( inventoryH[dragitem][1] ) setTimer ( refreshItemsInNewInventory, 500, 1, true ) else triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","O assunto não se encaixa",22,255,0) end else if currentMainWeap then dropCurrentWeapon() end moveItemInInventory ( inventoryH[dragitem][1] ) end elseif isElement ( currentLabelSelf ) and currentLabelOwner == 1 and colorORANGE and cur_craft_recipe then -- если крафт тут showRightClickCraftMenu () draggingAdditWeap = false dragitem = 0 return true elseif isElement ( currentLabelSelf ) and currentLabelOwner == 4 then -- если перетаскиваем из Frioго оружия в FERRAMENTAS if colorGREEN then setElementData ( getLocalPlayer(), "currentweapon_2", "noweap" ) -- обнуляем текущее Frioе оружие currentAdditWeap = false setGlobalOff() refreshItemsInNewInventory() -- обновляем список предметов end elseif isElement ( currentLabelWeapAddit ) and currentLabelOwner == 1 and draggingAdditWeap then -- если перетаскиваем из инвентаря в Frioе оружие useItems(draggingAdditWeap,"Pegue armas extra") elseif isElement ( currentLabelWeap ) and currentLabelOwner == 2 then -- если перетаскиваем из лута в огнестрел if currentMainWeap then dropCurrentWeapon() -- выбрасываем текущее основное оружие end moveItemInInventory ( inventoryH[dragitem][1] ) elseif isElement ( currentLabelHim ) and currentLabelOwner == 1 then -- если перетаскиваем из инвентаря no saque local csx, csy = 1, 1 if not inventory[dragitem][8] then csx, csy = inventory[dragitem][2], inventory[dragitem][3] end if checkSpaceForItemH ( csx, csy ) then moveItemOutOfInventory ( inventory[dragitem][1] ) setTimer ( refreshItemsInNewInventory, 500, 1, true ) else triggerEvent ("displayClientInfo",getLocalPlayer(),"inventory","O assunto não se encaixa no saque",22,255,0) end elseif isElement ( currentLabelHim ) and currentLabelOwner == 3 then -- если перетаскиваем из огнестрела no saque local weap = getItemData (currentMainWeap) if checkSpaceForItemH ( weap[2], weap[3] ) then moveItemOutOfInventory ( weap[1] ) setTimer ( refreshItemsInNewInventory, 500, 1, true ) else triggerEvent ("displayClientInfo",getLocalPlayer(),"inventory","O assunto não se encaixa no saque",22,255,0) end elseif isElement ( currentLabelHim ) and currentLabelOwner == 4 then -- если перетаскиваем из огнестрела no saque local weap = getItemData (currentAdditWeap) if checkSpaceForItemH ( weap[2], weap[3] ) then moveItemOutOfInventory ( weap[1] ) setTimer ( refreshItemsInNewInventory, 500, 1, true ) else triggerEvent ("displayClientInfo",getLocalPlayer(),"inventory","O assunto não se encaixa no saque",22,255,0) end end draggingAdditWeap = false dragitem = 0 end function itemLabelLeaved () currentLabelSelf = false currentLabelHim = false infoShowing = false currentLabelWeap = false onWeaponLabel = false currentLabelWeapAddit = false colorRED = false -- если тормозит при перемещении вещей, то убрать colorGREEN = false -- если тормозит при перемещении вещей, то убрать colorBLUE = false -- если тормозит при перемещении вещей, то убрать colorORANGE = false -- тут if isTimer ( infotimer ) then killTimer (infotimer) end end function checkCraftingRecipes ( items_given ) Link to comment
DNL291 Posted July 11, 2015 Share Posted July 11, 2015 Para a barra de rolagem DX, você pode fazer usando estas funções: dxCreateRenderTarget dxSetRenderTarget getTickCount interpolateBetween dxDrawRectangle getKeyState Mas para isso, você precisa de um bom entendimento em Lua. Como saber fazer um render target, fazer cálculos, saber usar a função interpolateBetween, além de outras coisas. Link to comment
brunob22 Posted July 11, 2015 Author Share Posted July 11, 2015 Para a barra de rolagem DX, você pode fazer usando estas funções: dxCreateRenderTarget dxSetRenderTarget getTickCount interpolateBetween dxDrawRectangle getKeyState Mas para isso, você precisa de um bom entendimento em Lua. Como saber fazer um render target, fazer cálculos, saber usar a função interpolateBetween, além de outras coisas. eu sou burro kkkk mais vou tenta Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now