Bonika

Untitled

Jan 12th, 2020
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 77.08 KB | None | 0 0
  1. local func = {}
  2.  
  3. sX, sY = guiGetScreenSize()
  4.  
  5. pW, pH = 461, 246
  6.  
  7. s = {guiGetScreenSize()}
  8.  
  9. moveX, moveY = s[1]/1.2 -pW/2,s[2]/2 - pH/2
  10.  
  11. showInventory = false
  12.  
  13. local showLeft = false
  14.  
  15. local categoryFont = dxCreateFont("files/opensans.ttf",13, true)
  16.  
  17. local usedFont = dxCreateFont("files/Roboto.ttf",11)
  18.  
  19. local weightFont = dxCreateFont("files/Roboto.ttf",9)
  20.  
  21.  
  22.  
  23. local toolfont = dxCreateFont("files/Roboto.ttf", 9)
  24.  
  25. local font = dxCreateFont("files/Roboto.ttf", 10)
  26.  
  27. local lastClick = 0
  28.  
  29. local invMenu = 1
  30.  
  31. local selectedAmount = 1
  32.  
  33. local amountBox = nil
  34.  
  35. local amountTable = {}
  36.  
  37. local doBlind = 0
  38.  
  39. local inAmountBox = false
  40.  
  41. local inSlotBox = false
  42.  
  43. local showBar = true
  44.  
  45. local selectedSound = 0
  46.  
  47. local updateClick = 0
  48.  
  49. -- Funkció rész
  50.  
  51. playerItems = {}
  52.  
  53. inventoryItems = {}
  54.  
  55. actionBarItems = {}
  56.  
  57. usedSlots = 0
  58.  
  59. local actionItems = {}
  60.  
  61. elementSource = nil
  62.  
  63. activeSide = "bag"
  64.  
  65. newMenu = nil
  66.  
  67. local vehBoot = false
  68.  
  69. local hoverSlot = -1
  70.  
  71. local hoverItem = nil
  72.  
  73.  
  74.  
  75. local inMove = false
  76.  
  77. local startTick = -1
  78.  
  79. local movedItem = nil
  80.  
  81. local movedSlot = -1
  82.  
  83.  
  84.  
  85. local inClone = false
  86.  
  87. local clonedItem = nil
  88.  
  89. local clonedSlot = -1
  90.  
  91.  
  92.  
  93. -- Action Bar
  94.  
  95. local actionSlots = 6
  96.  
  97.  
  98.  
  99. local isCursorInAction = false
  100.  
  101. local current_action_slot = -1
  102.  
  103. local isMove = false
  104.  
  105. local isActMove = false
  106.  
  107. defX, defY = 0,0
  108.  
  109. barX, barY = 0,0
  110.  
  111. actBox = {255,itemSize}
  112.  
  113. actPos = {s[1] / 2 - 251 / 2, s[2] - (46) - 15}
  114.  
  115. namePos = {0,0,200,28}
  116.  
  117. local showNameBar = false
  118.  
  119. local showNameSlot = -1
  120.  
  121. local nameGui = nil
  122.  
  123. local loading = 1000
  124.  
  125. local rotate = 0
  126.  
  127. opensans = dxCreateFont("files/opensans.ttf", 12)
  128.  
  129. local listShow = false
  130.  
  131. local listWheel = 0
  132.  
  133. local searchWheel = 0
  134.  
  135. local lastClick = 0
  136.  
  137. activeWeaponSlot = -1
  138.  
  139. activeAmmoSlot = -1
  140.  
  141. activeIdentity = -1
  142.  
  143. activeMask = -1
  144.  
  145. activeShield = -1
  146.  
  147. activeBadge = -1
  148.  
  149. activePhone = -1
  150.  
  151. activeBomb = -1
  152.  
  153. activeBriefCase = -1
  154.  
  155. activeCan = -1
  156.  
  157. local searchGui = nil
  158.  
  159. local listBox = {330,530}
  160.  
  161. local listPos = {s[1]/2 -listBox[1]/2,s[2]/2 - listBox[2]/2}
  162.  
  163. local addTimer
  164.  
  165.  
  166.  
  167. local showActionBar = true
  168.  
  169.  
  170.  
  171. addCommandHandler('togbar', function()
  172.  
  173. showActionBar = not showActionBar
  174.  
  175. end)
  176.  
  177.  
  178.  
  179. function deleteActiveWeaponSlot()
  180.  
  181. activeWeaponSlot = -1
  182.  
  183. end
  184.  
  185.  
  186.  
  187. hotTable = {
  188.  
  189. --WEAPID,NUM(1-től 100-ig)
  190.  
  191. [22] = 1.0+10, --Colt
  192.  
  193. [23] = 1.0+11, --Silenced
  194.  
  195. [24] = 1.0+18, -- deagle
  196.  
  197. [25] = 1.0+27, --Shotgun
  198.  
  199. [26] = 1.0+23, --Sawed off
  200.  
  201. [28] = 1.0+3, --Uzi
  202.  
  203. [29] = 1.0+4, --MP5
  204.  
  205. [30] = 1.0+4.5, --AK
  206.  
  207. [31] = 1.0+3.2, --M4
  208.  
  209. [32] = 1.0+3, --TEC-9
  210.  
  211. [33] = 1.0+23, --Rifle
  212.  
  213. [34] = 1.0+26, --Sniper
  214.  
  215. }
  216.  
  217.  
  218.  
  219. local categoryTable = {
  220.  
  221. {"bag","Tárgyak","bag"},
  222.  
  223. {"key","Kulcsok","key"},
  224.  
  225. {"craft","Barkácsolás","craft"},
  226.  
  227. }
  228.  
  229.  
  230.  
  231. addEventHandler("onClientElementDataChange",getRootElement(),function()
  232.  
  233. if getElementData(localPlayer,"timedOut") then
  234.  
  235. showInventory = false
  236.  
  237. end
  238.  
  239. end)
  240.  
  241.  
  242.  
  243. function getCursorFuck()
  244.  
  245. cX, cY = getCursorPosition()
  246.  
  247. cX, cY = cX*sX, cY*sY
  248.  
  249. return cX, cY
  250.  
  251. end
  252.  
  253. local plusSlot = 0
  254.  
  255. addEventHandler("onClientClick",getRootElement(),function(button,state)
  256.  
  257. if showInventory then
  258.  
  259. if button == "left" and state == "down" then
  260.  
  261. if isInBox(moveX,moveY,pW-76,23) then
  262.  
  263. if not showNameBar then
  264.  
  265. isMove = true
  266.  
  267. local curX, curY = getCursorFuck()
  268.  
  269. local x,y = moveX,moveY
  270.  
  271. defX, defY = curX - x, curY - y
  272.  
  273. end
  274.  
  275. elseif isInBox(moveX+5,moveY+39+(hoverCategory - 1)*69,48,48) then
  276.  
  277. if not inMove then
  278.  
  279. if not showNameBar then
  280.  
  281. if invMenu ~= hoverCategory then
  282.  
  283. closeCraft()
  284.  
  285. if categoryTable[hoverCategory] then
  286.  
  287. playSound("files/bincoselect.mp3")
  288.  
  289. invMenu = hoverCategory
  290.  
  291. activeSide = categoryTable[hoverCategory][3]
  292.  
  293. end
  294.  
  295. end
  296.  
  297. end
  298.  
  299. end
  300.  
  301. end
  302.  
  303. if showNameBar then
  304.  
  305. if isInBox(namePos[1]+115,namePos[2]+4,25,namePos[4]-8) then
  306.  
  307. setItemName(showNameSlot,guiGetText(nameGui))
  308.  
  309. outputChatBox("[RiseMTA]:#ffffff Sikeresen átneveztél egy tárgyat, egy #3D7ABC'névtábla'#ffffff használatával.",172, 211, 115,true)
  310.  
  311. showNameBar = false
  312.  
  313. showNameSlot = -1
  314.  
  315. if isElement(nameGui) then
  316.  
  317. destroyElement(nameGui)
  318.  
  319. end
  320.  
  321. takeItem(175)
  322.  
  323. elseif isInBox(namePos[1]+145,namePos[2]+4,50,namePos[4]-8) then
  324.  
  325. showNameBar = false
  326.  
  327. showNameSlot = -1
  328.  
  329. if isElement(nameGui) then
  330.  
  331. destroyElement(nameGui)
  332.  
  333. end
  334.  
  335. end
  336.  
  337. end
  338.  
  339. elseif button == "left" and state == "up" then
  340.  
  341. if isMove then
  342.  
  343. isMove = false
  344.  
  345. end
  346.  
  347. end
  348.  
  349. end
  350.  
  351. end)
  352.  
  353.  
  354.  
  355. addCommandHandler("resetinv",function()
  356.  
  357. if getElementData(localPlayer,"loggedin") then
  358.  
  359. if showInventory then
  360.  
  361. moveX, moveY = s[1]/1.2 -pW/2,s[2]/2 - pH/2
  362.  
  363. end
  364.  
  365. end
  366.  
  367. end)
  368.  
  369.  
  370.  
  371.  
  372.  
  373. bindKey("i", "down",function()
  374.  
  375. if getElementData(localPlayer, "loggedin") and not inAmountBox and not getElementData(localPlayer, "showKillPanel") and not getElementData(localPlayer, "disabled") then
  376.  
  377. if not isTimer(addTimer) then
  378.  
  379. closeCraft()
  380.  
  381. openInventory(localPlayer)
  382.  
  383. else
  384.  
  385. outputChatBox("[RiseMTA]:#ffffff Tárgyaid betöltése folyamatban... Várj #D231312#ffffff másodpercet.",172, 211, 115,true)
  386.  
  387. end
  388.  
  389. end
  390.  
  391. end)
  392.  
  393.  
  394.  
  395. function openTInventory(target)
  396.  
  397. openInventory(target)
  398.  
  399. end
  400.  
  401.  
  402.  
  403. addCommandHandler("createsafe",
  404.  
  405. function()
  406.  
  407. if getElementData(localPlayer, "acc:admin") >= 7 then
  408.  
  409. if getElementInterior(localPlayer) == 0 or getElementDimension(localPlayer) == 0 then
  410.  
  411. outputChatBox("#DC143C[RiseMTA - Széf]: #FFFFFFCsak interiorban használhatod ezt a parancsot.", 255, 255, 255, true)
  412.  
  413. else
  414.  
  415. triggerServerEvent("addSafeToServer",localPlayer,localPlayer)
  416.  
  417. end
  418.  
  419. end
  420.  
  421. end
  422.  
  423. )
  424.  
  425.  
  426.  
  427. bindKey("delete","down",function()
  428.  
  429. if not showInventory then return end
  430.  
  431. if getElementData(localPlayer,"acc:admin") >= 7 then
  432.  
  433. if getElementData(localPlayer,"char:adminduty") == 1 then
  434.  
  435. if hoverItem then
  436.  
  437. if hoverSlot == activeAmmoSlot then
  438.  
  439. activeAmmoSlot = -1
  440.  
  441. elseif hoverSlot == activeIdentity then
  442.  
  443. activeIdentity = -1
  444.  
  445. elseif hoverSlot == activeWeapon then
  446.  
  447. activeWeapon = -1
  448.  
  449. end
  450.  
  451. if weaponModels[hoverItem["id"]] then
  452.  
  453. triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,hoverItem["id"],hoverItem["value"],hoverItem["dbid"])
  454.  
  455. end
  456.  
  457. triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, hoverItem)
  458.  
  459. inventoryItems[elementSource][activeSide][hoverSlot] = nil
  460.  
  461. end
  462.  
  463. end
  464.  
  465. end
  466.  
  467. end)
  468.  
  469.  
  470.  
  471. function tooltip( text, text2 )
  472.  
  473. if inMove then return end
  474.  
  475. local x,y = getCursorPosition( )
  476.  
  477. local x,y = x * sX, y * sY
  478.  
  479. text = tostring( text )
  480.  
  481. if text2 then
  482.  
  483. text2 = tostring( text2 )
  484.  
  485. end
  486.  
  487.  
  488.  
  489. if text == text2 then
  490.  
  491. text2 = nil
  492.  
  493. end
  494.  
  495.  
  496.  
  497. local width = dxGetTextWidth(text,1,"clear") - 40
  498.  
  499. if text2 then
  500.  
  501. width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) - 20 )
  502.  
  503. text = text .. "\n"..text2
  504.  
  505. end
  506.  
  507. local height = 8 * ( text2 and 5 or 3)
  508.  
  509. x = math.max( 10, math.min( x, sX - width - 10 ) )
  510.  
  511. y = math.max( 10, math.min( y, sY - height - 10 ) )
  512.  
  513. dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
  514.  
  515. dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
  516.  
  517. end
  518.  
  519.  
  520.  
  521. function tooltipWeight( text, text2 )
  522.  
  523. if inMove then return end
  524.  
  525. local x,y = getCursorPosition( )
  526.  
  527. local x,y = x * sX, y * sY
  528.  
  529. text = tostring( text )
  530.  
  531. if text2 then
  532.  
  533. text2 = tostring( text2 )
  534.  
  535. end
  536.  
  537.  
  538.  
  539. if text == text2 then
  540.  
  541. text2 = nil
  542.  
  543. end
  544.  
  545.  
  546.  
  547. local width = dxGetTextWidth(text,1,"clear")-30
  548.  
  549. if text2 then
  550.  
  551. width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) + 20 )
  552.  
  553. text = text .. "\n"..text2
  554.  
  555. end
  556.  
  557. local height = 9* ( text2 and 5 or 3)
  558.  
  559. x = math.max( 10, math.min( x, sX - width - 10 ) )
  560.  
  561. y = math.max( 10, math.min( y, sY - height - 10 ) )
  562.  
  563. dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
  564.  
  565. dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
  566.  
  567. end
  568.  
  569.  
  570.  
  571. function tooltipWeapons( text, text2 )
  572.  
  573. if inMove then return end
  574.  
  575. local x,y = getCursorPosition( )
  576.  
  577. local x,y = x * sX, y * sY
  578.  
  579. text = tostring( text )
  580.  
  581. if text2 then
  582.  
  583. text2 = tostring( text2 )
  584.  
  585. end
  586.  
  587.  
  588.  
  589. if text == text2 then
  590.  
  591. text2 = nil
  592.  
  593. end
  594.  
  595.  
  596.  
  597. local width = dxGetTextWidth( text, 1, "clear" ) - 110
  598.  
  599. if text2 then
  600.  
  601. width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) - 20 )
  602.  
  603. text = text .. "\n" .. text2
  604.  
  605. end
  606.  
  607. local height = 11 * ( text2 and 5 or 3)
  608.  
  609. x = math.max( 10, math.min( x, sX - width - 10 ) )
  610.  
  611. y = math.max( 10, math.min( y, sY - height - 10 ) )
  612.  
  613. dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
  614.  
  615. dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
  616.  
  617. end
  618.  
  619.  
  620.  
  621. function tooltipAdmin( text, text2 )
  622.  
  623. if inMove then return end
  624.  
  625. local x,y = getCursorPosition( )
  626.  
  627. local x,y = x * sX, y * sY
  628.  
  629. text = tostring( text )
  630.  
  631. if text2 then
  632.  
  633. text2 = tostring( text2 )
  634.  
  635. end
  636.  
  637.  
  638.  
  639. if text == text2 then
  640.  
  641. text2 = nil
  642.  
  643. end
  644.  
  645.  
  646.  
  647. local width = dxGetTextWidth( text, 1, "clear" ) - 100
  648.  
  649. if text2 then
  650.  
  651. width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) - 20 )
  652.  
  653. text = text .. "\n" .. text2
  654.  
  655. end
  656.  
  657. local height = 14 * ( text2 and 5 or 3)
  658.  
  659. x = math.max( 10, math.min( x, sX - width - 10 ) )
  660.  
  661. y = math.max( 10, math.min( y, sY - height - 10 ) )
  662.  
  663. dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
  664.  
  665. dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
  666.  
  667. end
  668.  
  669.  
  670.  
  671. function tooltip_item( x,y,text, text2 )
  672.  
  673. text = tostring( text )
  674.  
  675. if text2 then
  676.  
  677. text2 = tostring( text2 )
  678.  
  679. end
  680.  
  681.  
  682.  
  683. if text == text2 then
  684.  
  685. text2 = nil
  686.  
  687. end
  688.  
  689.  
  690.  
  691. local width = dxGetTextWidth( text, 1, "clear" ) + 10
  692.  
  693. if text2 then
  694.  
  695. width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) + 10 )
  696.  
  697. text = text .. "\n" .. text2
  698.  
  699. y = y - 20
  700.  
  701. end
  702.  
  703. local height = 10 * ( text2 and 4 or 2 )
  704.  
  705. x = x - (width/1.5) + (itemSize)
  706.  
  707. dxDrawText( text, x+28, y+78, x + width, y + height, tooltip_text_color, 0.8, font, "center", "center", false, false, false )
  708.  
  709. end
  710.  
  711.  
  712.  
  713.  
  714.  
  715. function openInventory(pElement)
  716.  
  717. if (pElement) then
  718.  
  719. showInventory = not showInventory
  720.  
  721. triggerServerEvent("getElementItems", localPlayer, localPlayer, pElement, 2)
  722.  
  723. activeSide = "bag"
  724.  
  725. if showInventory then
  726.  
  727. setElementData(localPlayer,"show:inv",pElement)
  728.  
  729. else
  730.  
  731. amountTable = {}
  732.  
  733. invMenu = 1
  734.  
  735. activeSide = "bag"
  736.  
  737. if getElementType(elementSource) == "vehicle" then
  738.  
  739. setElementData(elementSource, "veh:player", nil)
  740.  
  741. setElementData(elementSource, "veh:use", false)
  742.  
  743. triggerServerEvent("doorState", localPlayer, elementSource, 0)
  744.  
  745. end
  746.  
  747. if (tostring(getElementType(elementSource))=="object") then
  748.  
  749. if getElementModel(elementSource) == 2332 then
  750.  
  751. setElementData(elementSource,"safe:use",false)
  752.  
  753. setElementData(elementSource,"safe:player",nil)
  754.  
  755. end
  756.  
  757. end
  758.  
  759. setElementData(localPlayer,"show:inv",localPlayer)
  760.  
  761. end
  762.  
  763.  
  764.  
  765. end
  766.  
  767. end
  768.  
  769.  
  770.  
  771. addEventHandler("onClientElementDataChange", root, function(dataName, oldValue)
  772.  
  773. if source == localPlayer then
  774.  
  775. if dataName == "acc:id" then
  776.  
  777. local newValue = tonumber(getElementData(source, dataName))
  778.  
  779. if newValue > 0 then
  780.  
  781. triggerServerEvent("getElementItems", localPlayer, localPlayer, localPlayer, 2)
  782.  
  783. triggerServerEvent("loadActionBarItems",localPlayer,localPlayer)
  784.  
  785. end
  786.  
  787. end
  788.  
  789. end
  790.  
  791. end)
  792.  
  793.  
  794.  
  795. function setElementItems(itemsTable, itemValue, pElement)
  796.  
  797. elementSource = pElement
  798.  
  799. if (itemValue == 2) then
  800.  
  801. playerItems = itemsTable
  802.  
  803. end
  804.  
  805. if getElementType(pElement) == "vehicle" then
  806.  
  807. if showInventory then
  808.  
  809. elementSource = pElement
  810.  
  811. setElementData(elementSource, "veh:player",localPlayer)
  812.  
  813. setElementData(elementSource, "veh:use", true)
  814.  
  815. --triggerServerEvent("doorState", localPlayer, elementSource, 0)
  816.  
  817. else
  818.  
  819. elementSource = localPlayer
  820.  
  821. setElementData(pElement, "veh:player", nil)
  822.  
  823. setElementData(pElement, "veh:use", false)
  824.  
  825. triggerServerEvent("doorState", localPlayer, pElement, 0)
  826.  
  827. end
  828.  
  829. end
  830.  
  831. if getElementType(pElement) == "object" then
  832.  
  833. if showInventory then
  834.  
  835. elementSource = pElement
  836.  
  837. setElementData(elementSource,"safe:use",true)
  838.  
  839. setElementData(elementSource,"safe:player",localPlayer)
  840.  
  841. else
  842.  
  843. elementSource = localPlayer
  844.  
  845. setElementData(pElement,"safe:use",false)
  846.  
  847. setElementData(pElement,"safe:player",nil)
  848.  
  849. end
  850.  
  851. end
  852.  
  853. inventoryItems = itemsTable
  854.  
  855. end
  856.  
  857. addEvent("setElementItems", true)
  858.  
  859. addEventHandler("setElementItems", getRootElement(), setElementItems)
  860.  
  861.  
  862.  
  863. addEvent("actionBarEvent",true)
  864.  
  865. addEventHandler("actionBarEvent",getRootElement(),function(loadedPlayer,tbl)
  866.  
  867. for k,v in ipairs(tbl) do
  868.  
  869. actionBarItems[loadedPlayer][v["actionslot"]] = {v["itemdbid"],v["item"],v["category"]}
  870.  
  871. end
  872.  
  873. end)
  874.  
  875.  
  876.  
  877. addEvent("delActionBarSlot",true)
  878.  
  879. addEventHandler("delActionBarSlot",getRootElement(),function(element,slot)
  880.  
  881. actionBarItems[element][slot] = {-1, -1, ""}
  882.  
  883. end)
  884.  
  885.  
  886.  
  887. function getItemImage(itemID,value)
  888.  
  889. value = tonumber(value)
  890.  
  891. if (tonumber(itemID)) then
  892.  
  893. if (itemID == 17 and value == 20) or (itemID == 17 and value == 21) then
  894.  
  895. itempng = itemID.."_"..value
  896.  
  897. else
  898.  
  899. itempng = itemID
  900.  
  901. end
  902.  
  903. if (fileExists(":rise_item/files/items/" .. itempng .. ".png")) then
  904.  
  905. return ":rise_item/files/items/" .. itempng .. ".png"
  906.  
  907. end
  908.  
  909. return ":rise_item/files/noitem.png"
  910.  
  911. end
  912.  
  913. return ":rise_item/files/noitem.png"
  914.  
  915. end
  916.  
  917.  
  918.  
  919. -- local inAction = false
  920.  
  921. local inItem = false
  922.  
  923. local actionX, actionY = sX/2 - 269/2,sY - 54 - 10
  924.  
  925. local weaponHot = 0
  926.  
  927. local randState = 0
  928.  
  929. local mehet = true
  930.  
  931.  
  932.  
  933. addEventHandler("onClientElementStreamIn",getRootElement(),function()
  934.  
  935. if getElementType(source) == "player" then
  936.  
  937. if source == localPlayer then
  938.  
  939. if getElementData(localPlayer,"loggedin") then
  940.  
  941. if getElementData(localPlayer,"active:itemID") == -1 then
  942.  
  943. createClientAttachWeapons()
  944.  
  945. end
  946.  
  947. if getElementData(localPlayer,"isBriefCaseInHand") then
  948.  
  949. triggerServerEvent("giveBriefCase",localPlayer,localPlayer)
  950.  
  951. end
  952.  
  953. end
  954.  
  955. end
  956.  
  957. end
  958.  
  959. end)
  960.  
  961.  
  962.  
  963. addEventHandler("onClientElementStreamOut",getRootElement(),function()
  964.  
  965. if getElementType(source) == "player" then
  966.  
  967. if source == localPlayer then
  968.  
  969. if getElementData(localPlayer,"loggedin") then
  970.  
  971. if getElementData(localPlayer,"active:itemID") == -1 then
  972.  
  973. destroyClientAttachWeapons()
  974.  
  975. end
  976.  
  977. if getElementData(localPlayer,"isBriefCaseInHand") then
  978.  
  979. triggerServerEvent("takeBriefCase",localPlayer,localPlayer)
  980.  
  981. end
  982.  
  983. end
  984.  
  985. end
  986.  
  987. end
  988.  
  989. end)
  990.  
  991.  
  992.  
  993. func.renderLoad = function()
  994.  
  995. if getElementData(localPlayer,"loggedin") then
  996.  
  997. --if mehet then
  998.  
  999. --mehet = false
  1000.  
  1001. removeEventHandler("onClientRender",getRootElement(),func.renderLoad)
  1002.  
  1003. local count = 0
  1004.  
  1005. addTimer = setTimer(function()
  1006.  
  1007.  
  1008.  
  1009. triggerServerEvent("getElementItems", localPlayer, localPlayer, localPlayer, 2)
  1010.  
  1011. triggerServerEvent("loadActionBarItems",localPlayer,localPlayer)
  1012.  
  1013. setTimer(function()
  1014.  
  1015. createClientAttachWeapons()
  1016.  
  1017. end,500,1)
  1018.  
  1019.  
  1020.  
  1021. end,2000,1)
  1022.  
  1023. --end
  1024.  
  1025. end
  1026.  
  1027. end
  1028.  
  1029. addEventHandler("onClientRender",getRootElement(),func.renderLoad,true,"low")
  1030.  
  1031.  
  1032.  
  1033. function createClientAttachWeapons()
  1034.  
  1035. if (playerItems[elementSource]["bag"]) then
  1036.  
  1037. for i = 1, row * column do
  1038.  
  1039. if (playerItems[elementSource]["bag"][i]) then
  1040.  
  1041. if weaponModels[playerItems[elementSource]["bag"][i]["id"]] then
  1042.  
  1043. outputChatBox("attach: "..getItemName(playerItems[elementSource]["bag"][i]["id"]))
  1044.  
  1045. triggerServerEvent("addAttachWeapon",localPlayer,localPlayer,playerItems[elementSource]["bag"][i]["id"],playerItems[elementSource]["bag"][i]["value"],playerItems[elementSource]["bag"][i]["dbid"])
  1046.  
  1047. end
  1048.  
  1049. end
  1050.  
  1051. end
  1052.  
  1053. end
  1054.  
  1055. end
  1056.  
  1057.  
  1058.  
  1059. function destroyClientAttachWeapons()
  1060.  
  1061. if (playerItems[elementSource]["bag"]) then
  1062.  
  1063. for i = 1, row * column do
  1064.  
  1065. if (playerItems[elementSource]["bag"][i]) then
  1066.  
  1067. if weaponModels[playerItems[elementSource]["bag"][i]["id"]] then
  1068.  
  1069. triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,playerItems[elementSource]["bag"][i]["id"],playerItems[elementSource]["bag"][i]["value"],playerItems[elementSource]["bag"][i]["dbid"])
  1070.  
  1071. end
  1072.  
  1073. end
  1074.  
  1075. end
  1076.  
  1077. end
  1078.  
  1079. end
  1080.  
  1081.  
  1082.  
  1083. addEventHandler("onClientResourceStart",resourceRoot,function()
  1084.  
  1085. setElementData(localPlayer,"weap:hot",0)
  1086.  
  1087. setElementData(localPlayer,"handFlex",false)
  1088.  
  1089. setElementData(localPlayer,"handTaser",false)
  1090.  
  1091. setElementData(localPlayer,"hand:bomb",false)
  1092.  
  1093. setElementData(localPlayer,"active:itemID",-1)
  1094.  
  1095. setElementData(localPlayer,"active:itemSlot",-1)
  1096.  
  1097. setElementData(localPlayer,"gasMaskInHead",false)
  1098.  
  1099. setElementData(localPlayer,"badgeState", false)
  1100.  
  1101. setElementData(localPlayer,"drugUsing",false)
  1102.  
  1103. setElementData(localPlayer,"show:inv",localPlayer)
  1104.  
  1105. setElementData(localPlayer,"isBriefCaseInHand",false)
  1106.  
  1107. setElementData(localPlayer,"handCan",false)
  1108.  
  1109. --engineImportTXD(engineLoadTXD("files/flex.txd"), 17613)
  1110.  
  1111. --engineReplaceModel(engineLoadDFF("files/flex.dff", 17613), 17613)
  1112.  
  1113. --engineReplaceCOL(engineLoadCOL ("files/flex.col" ), 17613)
  1114.  
  1115. engineImportTXD(engineLoadTXD("files/wateringcan.txd"), 2821)
  1116.  
  1117. engineReplaceModel(engineLoadDFF("files/wateringcan.dff", 2821), 2821)
  1118.  
  1119.  
  1120.  
  1121. actionBarItems[localPlayer] = {}
  1122.  
  1123. for i=1, actionSlots do
  1124.  
  1125. --itemDBID,itemID,itemType
  1126.  
  1127. actionBarItems[localPlayer][i] = {-1, -1, ""}
  1128.  
  1129. end
  1130.  
  1131. end)
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137. for i=1, actionSlots do
  1138.  
  1139. bindKey(i, "down", function()
  1140.  
  1141. if actionBarItems[localPlayer][i] and actionBarItems[localPlayer][i][1] > 0 and not inAmountBox and not getElementData(localPlayer, "showKillPanel") and not getElementData(localPlayer, "disabled") then
  1142.  
  1143. if actionBarItems[localPlayer][i][3] ~= 'empty' then
  1144.  
  1145. for b = 1, row * column do
  1146.  
  1147. if (playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]) then
  1148.  
  1149. if playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]["dbid"] == actionBarItems[localPlayer][i][1] then
  1150.  
  1151. useItem(playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b],b)
  1152.  
  1153. end
  1154.  
  1155. end
  1156.  
  1157. end
  1158.  
  1159. end
  1160.  
  1161. end
  1162.  
  1163. end)
  1164.  
  1165. end
  1166.  
  1167.  
  1168.  
  1169. function checkActionSlot(itemDBID)
  1170.  
  1171. for i = 1, actionSlots do
  1172.  
  1173. if (actionBarItems[localPlayer][i]) then
  1174.  
  1175. if (actionBarItems[localPlayer][i][1] == itemDBID) then
  1176.  
  1177. actionBarItems[localPlayer][i] = {-1, -1, ""}
  1178.  
  1179. end
  1180.  
  1181. end
  1182.  
  1183. end
  1184.  
  1185. end
  1186.  
  1187.  
  1188.  
  1189. setTimer(function()
  1190.  
  1191. if getElementData(localPlayer, "loggedin") then
  1192.  
  1193. pX,pY,pZ = getElementPosition(localPlayer)
  1194.  
  1195. if isElement(elementSource) then
  1196.  
  1197. eX,eY,eZ = getElementPosition(elementSource)
  1198.  
  1199. if getDistanceBetweenPoints3D(pX,pY,pZ,eX,eY,eZ) > 3.7 then
  1200.  
  1201. if showInventory then
  1202.  
  1203. invMenu = 1
  1204.  
  1205. activeSide = "bag"
  1206.  
  1207.  
  1208.  
  1209. if getElementType(elementSource) == "vehicle" then
  1210.  
  1211. setElementData(elementSource, "veh:player", nil)
  1212.  
  1213. setElementData(elementSource, "veh:use", false)
  1214.  
  1215. triggerServerEvent("doorState", localPlayer, elementSource, 0)
  1216.  
  1217. end
  1218.  
  1219. if (tostring(getElementType(elementSource))=="object") then
  1220.  
  1221. if getElementModel(elementSource) == 2332 then
  1222.  
  1223. setElementData(elementSource,"safe:use",false)
  1224.  
  1225. setElementData(elementSource,"safe:player",nil)
  1226.  
  1227. end
  1228.  
  1229. end
  1230.  
  1231. showInventory = false
  1232.  
  1233. triggerServerEvent("getElementItems", localPlayer, localPlayer, localPlayer, 2)
  1234.  
  1235. end
  1236.  
  1237. end
  1238.  
  1239. end
  1240.  
  1241. end
  1242.  
  1243. end,200,0)
  1244.  
  1245.  
  1246.  
  1247. func.renderInv = function()
  1248.  
  1249. hoverSlot = -1
  1250.  
  1251. hoverItem = nil
  1252.  
  1253. hoverCategory = 0
  1254.  
  1255.  
  1256.  
  1257. if getElementData(localPlayer, "loggedin") then
  1258.  
  1259. local activeItemID = getElementData(localPlayer,"active:itemID")
  1260.  
  1261. local activeitemSlot = getElementData(localPlayer,"active:itemSlot")
  1262.  
  1263. if(activeItemID>-1) and (activeitemSlot>-1) then
  1264.  
  1265. if weaponHot >= 0.1 then
  1266.  
  1267. weaponHot = weaponHot-0.3
  1268.  
  1269. setElementData(localPlayer,"weap:hot",getElementData(localPlayer,"weap:hot")-0.3)
  1270.  
  1271. end
  1272.  
  1273.  
  1274.  
  1275. if weaponHot+randState >= 89 then
  1276.  
  1277. weaponHot = 88
  1278.  
  1279. setElementData(localPlayer,"weap:hot",88)
  1280.  
  1281.  
  1282.  
  1283. takeStatus(getElementData(localPlayer,"active:weaponSlot"),randState)
  1284.  
  1285. randState = 0
  1286.  
  1287. toggleControl("fire",false)
  1288.  
  1289. playSound("files/overheat.mp3")
  1290.  
  1291. exports.rise_infobox:addNotificationFelsoC("A fegyvered túlmelegedett.", 2)
  1292.  
  1293. end
  1294.  
  1295. if weaponHot <= 18 then
  1296.  
  1297. -- if not getElementData(localPlayer, "death->arm->left") and not getElementData(localPlayer, "death->arm->right") then
  1298.  
  1299. --toggleControl("fire",true)
  1300.  
  1301. -- end
  1302.  
  1303. end
  1304.  
  1305. end
  1306.  
  1307. end
  1308.  
  1309.  
  1310.  
  1311. --if getElementData(localPlayer,"hudVisible") then
  1312.  
  1313. if getElementData(localPlayer, "loggedin") then
  1314.  
  1315. if getElementData(localPlayer, "screenmode") then return end
  1316.  
  1317. if showActionBar then
  1318.  
  1319. --actPos = {getElementData(localPlayer, "actionbar >> posX")+8, getElementData(localPlayer, "actionbar >> posY")+8}
  1320.  
  1321. --if getElementData(localPlayer, "actionbar >> enabled") then
  1322.  
  1323. actPos = {sX/2-251/2, sY-56}
  1324.  
  1325. dxDrawRectangle(actPos[1], actPos[2], 251, 46, tocolor(0, 0, 0, 200))
  1326.  
  1327. current_action_slot = -1
  1328.  
  1329.  
  1330.  
  1331. if isInBox(actPos[1]-10,actPos[2]-10,actBox[1]+20,actBox[2]+20) then
  1332.  
  1333. isCursorInAction = true
  1334.  
  1335. else
  1336.  
  1337. isCursorInAction = false
  1338.  
  1339. end
  1340.  
  1341.  
  1342.  
  1343. for i=1,actionSlots do
  1344.  
  1345. if (not guiGetInputEnabled() and not isMTAWindowActive() and not isCursorShowing() and actionBarItems[localPlayer][i][1] > -1 and getKeyState(i)) or isInBox(actPos[1]+5+(i-1)*41,actPos[2]+5, 36, 36) then
  1346.  
  1347. dxDrawRectangle(actPos[1]+5+(i-1)*41,actPos[2]+5, 36, 36, tocolor(200, 100, 0, 230))
  1348.  
  1349. current_action_slot = i
  1350.  
  1351. else
  1352.  
  1353. --dxDrawImage(actPos[1]+(i*((itemSize+8)+2))-49,actPos[2]-4, 44, 44,"files/slot.png",0,0,0,tocolor(0,0,0,170))
  1354.  
  1355. dxDrawRectangle(actPos[1]+5+(i-1)*41,actPos[2]+5, 36, 36, tocolor(44, 43, 42, 230))
  1356.  
  1357. end
  1358.  
  1359.  
  1360.  
  1361. if actionBarItems[localPlayer][i] and actionBarItems[localPlayer][i][3] == "empty" then
  1362.  
  1363. dxDrawImage(actPos[1]+(i*((itemSize+8)+2))-45.5+4,actPos[2]+5, itemSize, itemSize,'files/noitem.png', 0, 0, 0, tocolor(255,255,255, 255))
  1364.  
  1365. elseif (actionBarItems[localPlayer][i] and actionBarItems[localPlayer][i][1] > -1) then
  1366.  
  1367. for b = 1, row * column do
  1368.  
  1369. if (playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]) then
  1370.  
  1371. if playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]["dbid"] == actionBarItems[localPlayer][i][1] then
  1372.  
  1373. dxDrawImage(actPos[1]+4.5+(i-1)*(itemSize+margin),actPos[2]+5, itemSize, itemSize,getItemImage(actionBarItems[localPlayer][i][2],playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]["value"]), 0, 0, 0, tocolor(255,255,255, 255))
  1374.  
  1375. tooltip_item(actPos[1]+4.5+(i-1)*(itemSize+margin)-15,actPos[2]-17,playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]["count"])
  1376.  
  1377. end
  1378.  
  1379. end
  1380.  
  1381. end
  1382.  
  1383. end
  1384.  
  1385. --end
  1386.  
  1387. end
  1388.  
  1389. end
  1390.  
  1391. end
  1392.  
  1393. --end
  1394.  
  1395.  
  1396.  
  1397. if listShow then
  1398.  
  1399. dxDrawRectangle(listPos[1],listPos[2],listBox[1],listBox[2],tocolor(0,0,0,100))
  1400.  
  1401. dxCreateBorder(listPos[1],listPos[2],listBox[1],listBox[2],tocolor(0,0,0,200))
  1402.  
  1403. dxDrawRectangle(listPos[1]+20,listPos[2]+30,listBox[1]-40,1,tocolor(0,0,0,100))
  1404.  
  1405. dxDrawText("ID",listPos[1]+58,listPos[2]+3,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1406.  
  1407. dxDrawText("Név",listPos[1]+90,listPos[2]+3,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1408.  
  1409. dxDrawText("Súly",listPos[1]+230,listPos[2]+3,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1410.  
  1411. if isInBox(listPos[1]+307,listPos[2]+5,18,18) then
  1412.  
  1413. dxDrawText("",listPos[1]+307,listPos[2]+3,0,0,tocolor(210,49,49,255),1,icons,"left","top",true,true,true,true)
  1414.  
  1415. else
  1416.  
  1417. dxDrawText("",listPos[1]+307,listPos[2]+3,0,0,tocolor(255,255,255,255),1,icons,"left","top",true,true,true,true)
  1418.  
  1419. end
  1420.  
  1421. local guiText = guiGetText(searchGui)
  1422.  
  1423. dxDrawRectangle(listPos[1]+10,listPos[2]+495,160,25,tocolor(0,0,0,60))
  1424.  
  1425. dxDrawText(guiText,listPos[1]+13,listPos[2]+497,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1426.  
  1427. dxDrawImage(listPos[1]+176,listPos[2]+495,22,22,"files/search.png")
  1428.  
  1429. if guiText == "" then
  1430.  
  1431. local count = 0
  1432.  
  1433. for k,v in ipairs(items) do
  1434.  
  1435. if k > listWheel and count < 10 then
  1436.  
  1437. count = count+1
  1438.  
  1439. dxDrawImage(listPos[1]+10,listPos[2]-5+(count*45),36,36,getItemImage(tonumber(k)))
  1440.  
  1441. dxDrawText(tonumber(k),listPos[1]+62,listPos[2]+4+(count*45),0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1442.  
  1443. dxDrawText(v.name,listPos[1]+95,listPos[2]+4+(count*45),0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1444.  
  1445. dxDrawText(""..v.weight.." kg.",listPos[1]+235,listPos[2]+4+(count*45),0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1446.  
  1447. end
  1448.  
  1449. end
  1450.  
  1451. else
  1452.  
  1453. local newText = string.lower(string.gsub(guiText, "_", " "))
  1454.  
  1455. local count = 0
  1456.  
  1457. for k, v in ipairs(items) do
  1458.  
  1459. local name = string.lower(getItemName(k):gsub("_", " "))
  1460.  
  1461. if k == tonumber(newText) or string.find(name, newText) then
  1462.  
  1463. if k > searchWheel and count < 10 then
  1464.  
  1465. count = count+1
  1466.  
  1467. dxDrawImage(listPos[1]+10,listPos[2]-5+(count*45),36,36,getItemImage(tonumber(k)))
  1468.  
  1469. dxDrawText(tonumber(k),listPos[1]+62,listPos[2]+4+(count*45),0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1470.  
  1471. dxDrawText(v.name,listPos[1]+95,listPos[2]+4+(count*45),0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1472.  
  1473. dxDrawText(""..v.weight.." kg.",listPos[1]+235,listPos[2]+4+(count*45),0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1474.  
  1475. end
  1476.  
  1477. end
  1478.  
  1479. end
  1480.  
  1481. if count == 0 then
  1482.  
  1483. dxDrawText("Nincs találat!",listPos[1]+130,listPos[2]+40,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1484.  
  1485. end
  1486.  
  1487. end
  1488.  
  1489. end
  1490.  
  1491.  
  1492.  
  1493. if not showInventory then
  1494.  
  1495. return
  1496.  
  1497. end
  1498.  
  1499. if not isElement(elementSource) then
  1500.  
  1501. return
  1502.  
  1503. end
  1504.  
  1505.  
  1506.  
  1507. if showNameBar then
  1508.  
  1509. dxDrawRectangle(namePos[1],namePos[2],namePos[3],namePos[4],tocolor(0,0,0,120),true)
  1510.  
  1511. if isInBox(namePos[1]+145,namePos[2]+4,50,namePos[4]-8) then
  1512.  
  1513. dxDrawRectangle(namePos[1]+145,namePos[2]+4,50,namePos[4]-8,tocolor(172, 211, 115,200),true)
  1514.  
  1515. else
  1516.  
  1517. dxDrawRectangle(namePos[1]+145,namePos[2]+4,50,namePos[4]-8,tocolor(0,0,0,60),true)
  1518.  
  1519. end
  1520.  
  1521. dxDrawText("Mégse",namePos[1]+150,namePos[2]+4,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1522.  
  1523.  
  1524.  
  1525. if isInBox(namePos[1]+115,namePos[2]+4,25,namePos[4]-8) then
  1526.  
  1527. dxDrawRectangle(namePos[1]+115,namePos[2]+4,25,namePos[4]-8,tocolor(172, 211, 115,200),true)
  1528.  
  1529. else
  1530.  
  1531. dxDrawRectangle(namePos[1]+115,namePos[2]+4,25,namePos[4]-8,tocolor(0,0,0,60),true)
  1532.  
  1533. end
  1534.  
  1535. dxDrawText("Ok",namePos[1]+118,namePos[2]+4,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1536.  
  1537. if isElement(nameGui) then
  1538.  
  1539. if guiEditSetCaretIndex(nameGui, string.len(guiGetText(nameGui))) then
  1540.  
  1541. guiBringToFront(nameGui)
  1542.  
  1543. guiEditSetMaxLength(nameGui,15)
  1544.  
  1545. end
  1546.  
  1547. end
  1548.  
  1549. dxDrawRectangle(namePos[1]+5,namePos[2]+4,105,namePos[4]-8,tocolor(0,0,0,60),true)
  1550.  
  1551. dxDrawText(guiGetText(nameGui),namePos[1]+8,namePos[2]+4,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1552.  
  1553. end
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559. if isMove then
  1560.  
  1561. if isCursorShowing() then
  1562.  
  1563. local x, y = getCursorFuck()
  1564.  
  1565. moveX,moveY = x - defX,y - defY
  1566.  
  1567. end
  1568.  
  1569. end
  1570.  
  1571.  
  1572.  
  1573. local itemWeight = getAllItemWeight()
  1574.  
  1575. inItem = false
  1576.  
  1577. if (isInBox(moveX, moveY, pW+12, pH+75)) then
  1578.  
  1579. inItem = true
  1580.  
  1581. end
  1582.  
  1583.  
  1584.  
  1585. if getElementType(elementSource) == "vehicle" or getElementType(elementSource) == "object" then
  1586.  
  1587. if getElementType(elementSource) == "vehicle" then
  1588.  
  1589. dxDrawImage (moveX+5,moveY+39,40,48,"files/car.png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
  1590.  
  1591. elseif getElementType(elementSource) == "object" then
  1592.  
  1593. dxDrawImage (moveX+5,moveY+39,40,48,"files/safe.png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
  1594.  
  1595. end
  1596.  
  1597. else
  1598.  
  1599. for k,v in ipairs(categoryTable) do
  1600.  
  1601. --dxDrawImage (moveX-25-1+(k*35),moveY+224-22+1,25,27,"files/"..v[1]..".png", 0, 0, 0, tocolor(0,0,0,200),true)
  1602.  
  1603. if isInBox(moveX+5,moveY+39+(k-1)*69,40,48) then
  1604.  
  1605. dxDrawImage (moveX+5,moveY+39+(k-1)*69,40,48,"files/"..v[1]..".png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
  1606.  
  1607. if not inMove then
  1608.  
  1609. hoverCategory = k
  1610.  
  1611. end
  1612.  
  1613. else
  1614.  
  1615. if invMenu == k then
  1616.  
  1617. dxDrawImage (moveX+5,moveY+39+(k-1)*69,40,48,"files/"..v[1]..".png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
  1618.  
  1619. else
  1620.  
  1621. dxDrawImage (moveX+5,moveY+39+(k-1)*69,40,48,"files/"..v[1]..".png", 0, 0, 0, tocolor(106,101,94,230),true)
  1622.  
  1623. end
  1624.  
  1625. end
  1626.  
  1627. end
  1628.  
  1629. end
  1630.  
  1631.  
  1632.  
  1633. local drawRow = 0
  1634.  
  1635. local drawColumn = 0
  1636.  
  1637.  
  1638.  
  1639. if getElementType(elementSource) == "vehicle" then
  1640.  
  1641. categoryText = "Jármű"
  1642.  
  1643. elseif getElementType(elementSource) == "object" then
  1644.  
  1645. categoryText = "Széf"
  1646.  
  1647. else
  1648.  
  1649. categoryText = categoryTable[invMenu][2]
  1650.  
  1651. end
  1652.  
  1653. --usedSlots = 0
  1654.  
  1655. if activeSide == "bag" or activeSide == "key" or activeSide == "vehicle" or activeSide == "object" then
  1656.  
  1657. dxDrawImage(moveX-28, moveY-40, 550, 330,"files/bg.png",0,0,0,tocolor(0,0,0,220))
  1658.  
  1659. -- dxDrawRectangle(moveX, moveY, 461, 246, tocolor(0,0,0,200))
  1660.  
  1661. -- dxCreateBorder2(moveX, moveY, 461, 246, tocolor(0,0,0,240))
  1662.  
  1663. local skinID = getElementModel(localPlayer)
  1664.  
  1665. skinID = tostring(skinID)
  1666.  
  1667. if (string.len(skinID)==2) then
  1668.  
  1669. skinID = "0" .. skinID
  1670.  
  1671. elseif (string.len(skinID)==1) then
  1672.  
  1673. skinID = "00" .. skinID
  1674.  
  1675. end
  1676.  
  1677. dxDrawText("#ACD373"..categoryText..":", moveX+4, moveY,0,28+moveY,tocolor(255,255,255,255),1,categoryFont,"left","center",false,false,false,true)
  1678.  
  1679. local textWidth = dxGetTextWidth(categoryText, 1, categoryFont)
  1680.  
  1681. local textHeight = dxGetFontHeight(1, categoryFont)
  1682.  
  1683. dxDrawText("Jelenleg "..usedSlots.."/"..row*column.."db itemed van", moveX+textWidth+15, moveY+2, 0, 28+moveY, tocolor(255,255,255,255),1,usedFont, nil, "center", false, false, false, true)
  1684.  
  1685. local amountText = table.concat(amountTable)
  1686.  
  1687. if (inAmountBox) then
  1688.  
  1689. if (doBlind < 60) then
  1690.  
  1691. doBlind = doBlind + 1
  1692.  
  1693. else
  1694.  
  1695. doBlind = 0
  1696.  
  1697. end
  1698.  
  1699. if (doBlind <= 30) then
  1700.  
  1701. amountText = table.concat(amountTable) .. "|"
  1702.  
  1703. else
  1704.  
  1705. amountText = table.concat(amountTable)
  1706.  
  1707. end
  1708.  
  1709. end
  1710.  
  1711. roundedRectangle(moveX+461-53, moveY+3, 50, 20, tocolor(255,255,255,230))
  1712.  
  1713.  
  1714.  
  1715. dxDrawText(amountText, moveX+461-51, moveY+3, moveX+461-51, 20+moveY+3,tocolor(0, 0, 0, 255), 1.0, usedFont, "left", "center", false, false, false, true, true)
  1716.  
  1717. --if selectedAmount <= 0 then
  1718.  
  1719. -- selectedAmount = 1
  1720.  
  1721. --guiSetText(amountBox,1)
  1722.  
  1723. --end
  1724.  
  1725. dxDrawText("Mennyiség:",moveX+320, moveY+2,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
  1726.  
  1727. --dxDrawRectangle(moveX+320+45,moveY-6-2,50,15,tocolor(0,0,0,90))
  1728.  
  1729. --dxDrawRectangle(moveX+320+45,moveY-7-2,50,1,tocolor(0,0,0,160))
  1730.  
  1731. --dxDrawRectangle(moveX+320+45,moveY-6-2+15,50,1,tocolor(0,0,0,160))
  1732.  
  1733. --dxDrawRectangle(moveX+319+45,moveY-7-2,1,17,tocolor(0,0,0,160))
  1734.  
  1735. --dxDrawRectangle(moveX+319+45+51,moveY-7-2,1,17,tocolor(0,0,0,160))
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741. dxDrawRectangle(moveX+53,moveY+246-13,345,10,tocolor(189, 150, 72,200))
  1742. dxDrawRectangle(moveX+53,moveY+246-13,math.ceil(itemWeight)/getTypeOfElement(elementSource)[3]*345,10,tocolor(172, 211, 115,200))
  1743. dxDrawText(math.ceil(itemWeight).."/"..getTypeOfElement(elementSource)[3].."kg",moveX+408, moveY+246-13, moveX+408, 10+moveY+246-13, tocolor(255, 255, 255, 255), 1.0, weightFont, "left", "center",false,false,false,true)
  1744. --dxDrawRectangle(moveX+160-1,moveY+196+3,255,1,tocolor(0,0,0,160))
  1745. --dxDrawRectangle(moveX+160-1,moveY+196+3+13,255,1,tocolor(0,0,0,160))
  1746. --dxDrawRectangle(moveX+159-1,moveY+196+3,1,14,tocolor(0,0,0,160))
  1747. --dxDrawRectangle(moveX+159-1+256,moveY+196+3,1,14,tocolor(0,0,0,160))
  1748.  
  1749. usedSlots = 0
  1750.  
  1751. for i = 1, row * column do
  1752.  
  1753. if isInBox(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), itemSize, itemSize) then
  1754.  
  1755. inSlotBox = true
  1756.  
  1757. dxDrawRectangle(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, tocolor(200, 100, 0, 230))
  1758.  
  1759. hoverSlot = i
  1760.  
  1761. if (inventoryItems[elementSource][activeSide][i]) then
  1762.  
  1763. if selectedSound ~= i then
  1764.  
  1765. playSound("files/hover.mp3")
  1766.  
  1767. end
  1768.  
  1769. selectedSound = i
  1770.  
  1771. hoverItem = (inventoryItems[elementSource][activeSide][i])
  1772.  
  1773. local itemName = ""
  1774.  
  1775.  
  1776.  
  1777. if #inventoryItems[elementSource][activeSide][i]["name"] <= 0 then
  1778.  
  1779. itemName = getItemName(inventoryItems[elementSource][activeSide][i]["id"],tonumber(inventoryItems[elementSource][activeSide][i]["value"]))
  1780.  
  1781. else
  1782.  
  1783. itemName = inventoryItems[elementSource][activeSide][i]["name"]
  1784.  
  1785. end
  1786.  
  1787. if getElementData(localPlayer,"acc:admin") >= 8 and getElementData(localPlayer,"char:adminduty") == 1 then
  1788.  
  1789. tooltipAdmin("#ACD373"..itemName.."#ffffff #ffa800("..inventoryItems[elementSource][activeSide][i]["id"]..")#ffffff","SQL azonosító: #D23131"..inventoryItems[elementSource][activeSide][i]["dbid"].."#ffffff\nÉrték: #3D7ABC"..inventoryItems[elementSource][activeSide][i]["value"].."#ffffff\nÁllapot: #3D7ABC"..inventoryItems[elementSource][activeSide][i]["health"].."#ffffff %")
  1790.  
  1791. else
  1792.  
  1793. if inventoryItems[elementSource][activeSide][i]["id"] == 0 or inventoryItems[elementSource][activeSide][i]["id"] == 1 or inventoryItems[elementSource][activeSide][i]["id"] == 2 or inventoryItems[elementSource][activeSide][i]["id"] == 153 then
  1794.  
  1795. tooltip("#ACD373"..itemName.."#ffffff","((Azonosító: "..inventoryItems[elementSource][activeSide][i]["value"].."))")
  1796.  
  1797. --elseif inventoryItems[elementSource][activeSide][i]["id"] == 85 or inventoryItems[elementSource][activeSide][i]["id"] == 86 or inventoryItems[elementSource][activeSide][i]["id"] == 87 then
  1798.  
  1799. -- tooltip("#ACD373"..itemName.."#ffffff","Benne ültetve: #acd373"..items[inventoryItems[elementSource][activeSide][i]["id"]].description.."")
  1800.  
  1801. --elseif inventoryItems[elementSource][activeSide][i]["id"] == 147 then
  1802.  
  1803. -- tooltip("#ACD373"..itemName.."#ffffff","Befizetési határidő: #acd373"..tonumber(inventoryItems[elementSource][activeSide][i]["health"]).."#ffffff perc.")
  1804.  
  1805. --elseif inventoryItems[elementSource][activeSide][i]["id"] == 148 then
  1806.  
  1807. -- tooltip("#ACD373"..itemName.."#ffffff","Állapot: #acd373"..tonumber(inventoryItems[elementSource][activeSide][i]["health"]).."#ffffff %")
  1808.  
  1809. --elseif inventoryItems[elementSource][activeSide][i]["id"] == 65 then
  1810.  
  1811. -- tooltip("#ACD373"..itemName.."#ffffff","#ffa800"..tostring(inventoryItems[elementSource][activeSide][i]["value"]):gsub("_", " ").."#ffffff")
  1812.  
  1813. elseif inventoryItems[elementSource][activeSide][i]["id"] == 205 then
  1814.  
  1815. tooltip("#ACD373"..itemName.."#ffffff", "#ACD373Sorszám: #FF8800"..inventoryItems[elementSource][activeSide][i]['value'].."#ffffff", "Súly: #acd373"..items[inventoryItems[elementSource][activeSide][i]["id"]].weight*inventoryItems[elementSource][activeSide][i]["count"].."kg")
  1816.  
  1817. --elseif inventoryItems[elementSource][activeSide][i]["id"] == 160 then
  1818.  
  1819. -- tooltip("#ACD373"..itemName.."#ffffff","Még #acd373"..tonumber(inventoryItems[elementSource][activeSide][i]["value"]).."#ffffff szelet.")
  1820.  
  1821. --elseif inventoryItems[elementSource][activeSide][i]["id"] == 190 then
  1822.  
  1823. -- if tonumber(inventoryItems[elementSource][activeSide][i]["value"]) > 0 then
  1824.  
  1825. -- tooltip("#ACD373"..itemName.."#ffffff","Tartalma: #acd373"..inventoryItems[elementSource][activeSide][i]["value"].."#ffffff aranyrúd")
  1826.  
  1827. -- else
  1828.  
  1829. -- tooltip("#ACD373"..itemName.."#ffffff")
  1830.  
  1831. -- end
  1832.  
  1833. elseif hotTable[weaponIndexByID[inventoryItems[elementSource][activeSide][i]["id"]]] then
  1834.  
  1835. tooltipWeapons("#ACD373"..itemName.."#ffffff #787878["..inventoryItems[elementSource][activeSide][i]["weaponserial"].."]#ffffff","Állapot: #acd373"..inventoryItems[elementSource][activeSide][i]["health"].."#ffffff %\nSúly: #3D7ABC"..items[inventoryItems[elementSource][activeSide][i]["id"]].weight*inventoryItems[elementSource][activeSide][i]["count"].."#ffffff kg")
  1836.  
  1837. else
  1838.  
  1839. tooltip("#ACD373"..itemName.."#ffffff","Súly: #acd373"..items[inventoryItems[elementSource][activeSide][i]["id"]].weight*inventoryItems[elementSource][activeSide][i]["count"].."kg")
  1840.  
  1841. end
  1842.  
  1843. end
  1844.  
  1845. else
  1846.  
  1847. hoverItem = nil
  1848.  
  1849. end
  1850.  
  1851. else
  1852.  
  1853. dxDrawRectangle(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, tocolor(44, 43, 42, 230))
  1854.  
  1855. if inventoryItems[elementSource][activeSide][i] then
  1856.  
  1857. if getTypeOfElement(elementSource,tonumber(inventoryItems[elementSource][activeSide][i]["id"]))[1] == "bag" then
  1858.  
  1859. if activeAmmoSlot == i or activeWeaponSlot == i or activeMask == i or activeShield == i or activeBadge == i or activePhone == i or activeIdentity == i or activeBomb == i or activeBriefCase == i or activeCan == i then
  1860.  
  1861. dxDrawRectangle(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, tocolor(172, 211, 115, 230))
  1862.  
  1863. end
  1864.  
  1865. end
  1866.  
  1867. end
  1868.  
  1869. inSlotBox = false
  1870.  
  1871. end
  1872.  
  1873. local itemData = inventoryItems[elementSource][activeSide][i]
  1874.  
  1875. if (itemData) then
  1876.  
  1877. local itemDbid = itemData["dbid"]
  1878.  
  1879. local itemID = itemData["id"]
  1880.  
  1881. local itemCount = itemData["count"]
  1882.  
  1883. local itemHeath = itemData["health"]
  1884.  
  1885. usedSlots = usedSlots+1
  1886.  
  1887. if ((movedSlot == i)) then
  1888.  
  1889. inMove = true
  1890.  
  1891. local cX, cY = getCursorPosition()
  1892.  
  1893. if isCursorShowing() then
  1894.  
  1895. cX,cY = sX*cX,sY*cY
  1896.  
  1897. else
  1898.  
  1899. cX,cY = 0,0
  1900.  
  1901. end
  1902.  
  1903. dxDrawImage(cX - itemSize/2, cY - itemSize/2, itemSize, itemSize, getItemImage(tonumber(movedItem["id"]),movedItem["value"]), 0, 0, 0, tocolor(255, 255, 255, 255), true)
  1904.  
  1905. else
  1906.  
  1907. dxDrawImage(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, getItemImage(tonumber(itemID),itemData["value"]), 0, 0, 0, tocolor(255, 255, 255, 255))
  1908.  
  1909. tooltip_item(moveX + drawColumn * (itemSize + margin) + margin * 1+33, moveY + drawRow * (itemSize + margin) + margin * 1.6, itemCount)
  1910.  
  1911.  
  1912.  
  1913. if items[itemID] and items[itemID].statusbar then
  1914.  
  1915. dxDrawRectangle(moveX + drawColumn * (itemSize + margin) + margin * 1 + 2, moveY + drawRow * (itemSize + margin) + margin * 1.6 + itemSize - 6, itemSize - 4, 4, tocolor(0, 0, 0, 255))
  1916.  
  1917. dxDrawRectangle(moveX + drawColumn * (itemSize + margin) + margin * 1 + 2, moveY + drawRow * (itemSize + margin) + margin * 1.6 + itemSize - 6, itemHeath / 100 * (itemSize - 4), 4, tocolor(163, 93, 0, 255))
  1918.  
  1919. end
  1920.  
  1921. end
  1922.  
  1923. end
  1924.  
  1925. if (inClone) then
  1926.  
  1927. local cX, cY = getCursorPosition()
  1928.  
  1929. if isCursorShowing() then
  1930.  
  1931. cX,cY = sX*cX,sY*cY
  1932.  
  1933. else
  1934.  
  1935. cX,cY = 0,0
  1936.  
  1937. end
  1938.  
  1939. dxDrawImage(cX - itemSize/2, cY - itemSize/2, itemSize, itemSize, getItemImage(tonumber(clonedItem["id"]),clonedItem["value"]), 0, 0, 0, tocolor(255, 255, 255, 255), true)
  1940.  
  1941. end
  1942.  
  1943. drawColumn = drawColumn + 1
  1944.  
  1945. if (drawColumn == column) then
  1946.  
  1947. drawColumn = 0
  1948.  
  1949. drawRow = drawRow + 1
  1950.  
  1951. end
  1952.  
  1953. end
  1954.  
  1955. end
  1956.  
  1957. --end
  1958.  
  1959. --end
  1960.  
  1961. end
  1962.  
  1963. addEventHandler("onClientRender", getRootElement(), func.renderInv,true,"low")
  1964.  
  1965.  
  1966.  
  1967. func["invClick"] = function(pButton, pState, _, _, _, _, _, clickedElement)
  1968.  
  1969. if not isTimer(addTimer) then
  1970.  
  1971. if (pButton == "left" and pState == "down" and showInventory) then
  1972.  
  1973. if (tonumber(hoverSlot) > -1 and hoverItem and not inClone) then
  1974.  
  1975. if activeSide == "bag" and activeWeaponSlot == hoverSlot or activeAmmoSlot == hoverSlot or activeMask == hoverSlot or activeShield == hoverSlot or activeBadge == hoverSlot or activePhone == hoverSlot or activeBomb == hoverSlot or activeBriefCase == hoverSlot or activeCan == hoverSlot then
  1976.  
  1977. elseif activeSide == "bag" and activeIdentity == hoverSlot then
  1978.  
  1979. --elseif activeSide == "bag" and hoverItem["id"] == 206 then
  1980.  
  1981. --outputChatBox("[RiseMTA]:#ffffff Ezt a tárgyat nem mozgathatod.",172, 211, 115,true)
  1982.  
  1983. else
  1984.  
  1985. if not showNameBar then
  1986.  
  1987. startTick = getTickCount()
  1988.  
  1989. movedItem = hoverItem
  1990.  
  1991. movedSlot = tonumber(hoverSlot)
  1992.  
  1993. playSound("files/select.mp3")
  1994.  
  1995. if table.concat(amountTable) == "" then
  1996.  
  1997. nilMoving = true
  1998.  
  1999. else
  2000.  
  2001. inClone = true
  2002.  
  2003. clonedItem = hoverItem
  2004.  
  2005. clonedSlot = tonumber(hoverSlot)
  2006.  
  2007. end
  2008.  
  2009. end
  2010.  
  2011. end
  2012.  
  2013. end
  2014.  
  2015. if isInBox(moveX+461-53, moveY+3, 50, 20) then
  2016.  
  2017. inAmountBox = true
  2018.  
  2019. else
  2020.  
  2021. inAmountBox = false
  2022.  
  2023. end
  2024.  
  2025.  
  2026.  
  2027. if activeSide == "bag" or activeSide == "key" then
  2028.  
  2029. if(isCursorInAction and current_action_slot > -1) then
  2030.  
  2031. actionBarItems[elementSource][current_action_slot] = {-1, -1, ""}
  2032.  
  2033. triggerServerEvent("deleteActionBarItem",localPlayer,localPlayer,current_action_slot)
  2034.  
  2035. end
  2036.  
  2037. end
  2038.  
  2039. elseif (pButton == "left" and pState == "up" and showInventory) then
  2040.  
  2041.  
  2042.  
  2043. if activeSide == "bag" or activeSide == "key" then
  2044.  
  2045. if (not inItem and isCursorInAction and movedItem and movedSlot > -1) then
  2046.  
  2047. if actionBarItems[elementSource][current_action_slot][1] == -1 then
  2048.  
  2049. actionBarItems[elementSource][current_action_slot] = {movedItem["dbid"], movedItem["id"], activeSide}
  2050.  
  2051. triggerServerEvent("moveItemToActionBar",localPlayer,localPlayer,movedItem["dbid"], movedItem["id"], activeSide,current_action_slot)
  2052.  
  2053. end
  2054.  
  2055. end
  2056.  
  2057. if (not inItem and not isCursorInAction and movedItem and movedSlot > -1) then
  2058.  
  2059. if clickedElement and getElementType(clickedElement) == "object" and (getElementModel(clickedElement) ~= 1359 and getElementModel(clickedElement) ~= 2332) then
  2060.  
  2061. local screenx, screeny, worlditemX, worlditemY, worlditemZ = getCursorPosition()
  2062.  
  2063. local tx, ty, tz = getWorldFromScreenPosition ( sX*screenx, sY*screeny, 50 )
  2064.  
  2065. local px, py, pz = getCameraMatrix()
  2066.  
  2067. hit, gx,gy,gz, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz )
  2068.  
  2069. if getDistanceBetweenPoints3D(gx,gy,gz, getElementPosition(localPlayer)) < 3 then
  2070.  
  2071. if getItemDropable(movedItem["id"]) then
  2072.  
  2073. if movedItem["duty"] == 1 then
  2074.  
  2075. outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
  2076.  
  2077. else
  2078.  
  2079. triggerServerEvent("dropItem",localPlayer,localPlayer,gx,gy,gz,movedItem["id"],movedItem["value"],movedItem["count"],movedItem["health"],movedItem["name"])
  2080.  
  2081. if weaponModels[movedItem["id"]] then
  2082.  
  2083. triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,movedItem["id"],movedItem["value"],movedItem["dbid"])
  2084.  
  2085. end
  2086.  
  2087. triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, movedItem)
  2088.  
  2089. inventoryItems[elementSource][activeSide][movedSlot] = nil
  2090.  
  2091. end
  2092.  
  2093. else
  2094.  
  2095. outputChatBox("[RiseMTA]:#ffffff Ez a tárgy nem eldobható.",172, 211, 115,true)
  2096.  
  2097. end
  2098.  
  2099. end
  2100.  
  2101. end
  2102.  
  2103. end
  2104.  
  2105. end
  2106.  
  2107.  
  2108.  
  2109. if hoverSlot == movedSlot then
  2110.  
  2111. hideClone()
  2112.  
  2113. end
  2114.  
  2115.  
  2116.  
  2117. if not hoverItem then
  2118.  
  2119. if hoverSlot == -1 then
  2120.  
  2121. hideClone()
  2122.  
  2123. end
  2124.  
  2125. end
  2126.  
  2127.  
  2128.  
  2129. if hoverItem and movedItem then
  2130.  
  2131. if hoverItem["id"] == movedItem["id"] then
  2132.  
  2133. if not items[hoverItem["id"]].stackable then
  2134.  
  2135. if selectedAmount >= 1 then
  2136.  
  2137. hideClone()
  2138.  
  2139. end
  2140.  
  2141. end
  2142.  
  2143. elseif hoverItem["id"] ~= movedItem["id"] then
  2144.  
  2145. if selectedAmount >= 1 then
  2146.  
  2147. hideClone()
  2148.  
  2149. end
  2150.  
  2151. end
  2152.  
  2153. end
  2154.  
  2155. if (movedSlot > -1 and movedItem and not hoverItem and hoverSlot > -1 and hoverSlot ~= movedSlot and inItem and inMove) then
  2156.  
  2157. if table.concat(amountTable) == "" then
  2158.  
  2159. setItemSlot(movedSlot, hoverSlot)
  2160.  
  2161. delItemSlot(movedSlot)
  2162.  
  2163. else
  2164.  
  2165. if movedItem["count"] >= selectedAmount then
  2166.  
  2167. if movedItem["count"] - selectedAmount == 0 then
  2168.  
  2169. delItem(movedSlot,1)
  2170.  
  2171. else
  2172.  
  2173. setItemCount(movedSlot, movedItem["count"] - selectedAmount)
  2174.  
  2175. end
  2176.  
  2177. createNewItem(hoverSlot, movedItem["dbid"], movedItem["id"], movedItem["value"], selectedAmount, movedItem["duty"],movedItem["health"],movedItem["name"],movedItem["weaponserial"])
  2178.  
  2179. end
  2180.  
  2181. hideClone()
  2182.  
  2183. end
  2184.  
  2185. playSound("files/move.mp3")
  2186.  
  2187. elseif (movedSlot > -1 and movedItem and hoverItem and hoverSlot > -1 and hoverItem["id"] == movedItem["id"] and hoverSlot ~= movedSlot and inItem and inMove and items[movedItem["id"]].stackable) then
  2188.  
  2189. if table.concat(amountTable) == "" then
  2190.  
  2191. setItemCount(hoverSlot, hoverItem["count"] + movedItem["count"])
  2192.  
  2193. delItem(movedSlot)
  2194.  
  2195. else
  2196.  
  2197. if hoverItem["id"] == clonedItem["id"] then
  2198.  
  2199. if clonedItem["count"] >= selectedAmount then
  2200.  
  2201. setItemCount(movedSlot, movedItem["count"] - selectedAmount)
  2202.  
  2203. setItemCount(hoverSlot, hoverItem["count"] + selectedAmount)
  2204.  
  2205. if clonedItem["count"] == 0 then
  2206.  
  2207. delItem(clonedSlot)
  2208.  
  2209. end
  2210.  
  2211. end
  2212.  
  2213. hideClone()
  2214.  
  2215. end
  2216.  
  2217. end
  2218.  
  2219. elseif (movedSlot > -1 and movedItem and not inAction and inMove and not inItem and clickedElement and getElementType(clickedElement) == "vehicle" and (getElementData(clickedElement, "veh:id") > 0 or getElementData(clickedElement, 'rentboat:id'))) and not isCursorInAction then
  2220.  
  2221. if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
  2222.  
  2223. if not (isVehicleLocked(clickedElement)) then
  2224.  
  2225. if movedItem["duty"] == 1 then
  2226.  
  2227. outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
  2228.  
  2229. else
  2230.  
  2231. if movedItem["id"] ~= 93 then
  2232.  
  2233. updateClick = updateClick+1
  2234.  
  2235. triggerServerEvent("tradeItem", localPlayer, localPlayer, clickedElement, elementSource, movedItem,updateClick)
  2236.  
  2237. else
  2238.  
  2239. outputChatBox("[RiseMTA]:#ffffff A kiválasztott tárgyat, csak egy másik játékosnak tudod átadni.",172, 211, 115,true)
  2240.  
  2241. end
  2242.  
  2243. end
  2244.  
  2245. else
  2246.  
  2247. outputChatBox("[RiseMTA]:#ffffff A kiválasztott jármű zárva van.",172, 211, 115,true)
  2248.  
  2249. end
  2250.  
  2251. end
  2252.  
  2253. elseif (movedSlot > -1 and movedItem and not inAction and inMove and not inItem and clickedElement and getElementType(clickedElement) == "player" and getElementData(clickedElement, "acc:id") > 0) and not isCursorInAction and clickedElement ~= localPlayer then
  2254.  
  2255. if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
  2256.  
  2257. if movedItem["duty"] == 1 then
  2258.  
  2259. outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
  2260.  
  2261. else
  2262.  
  2263. if getElementType(elementSource) ~= "vehicle" and getElementType(elementSource) ~= "object" then
  2264.  
  2265. updateClick = updateClick+1
  2266.  
  2267. triggerServerEvent("tradeItem", localPlayer, localPlayer, clickedElement, elementSource, movedItem,updateClick)
  2268.  
  2269. else
  2270.  
  2271. outputChatBox("[RiseMTA]:#ffffff A kiválasztott inventoryból, csak magadra tudod húzni ezt a tárgyat.",172, 211, 115,true)
  2272.  
  2273. end
  2274.  
  2275. end
  2276.  
  2277. end
  2278.  
  2279. elseif (movedSlot > -1 and movedItem and not inAction and inMove and not inItem and clickedElement and getElementType(clickedElement) == "object") and getElementModel(clickedElement) == 1359 and clickedElement ~= localPlayer and not isCursorInAction then
  2280.  
  2281. if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
  2282.  
  2283. local itemName = ""
  2284.  
  2285. if #movedItem["name"] <= 0 then
  2286.  
  2287. itemName = getItemName(movedItem["id"],tonumber(movedItem["value"]))
  2288.  
  2289. else
  2290.  
  2291. itemName = movedItem["name"]
  2292.  
  2293. end
  2294.  
  2295. exports["rise_chat"]:sendLocalMeMessage(localPlayer,"kidob egy tárgyat a szemetesbe. ("..itemName..")")
  2296.  
  2297. if weaponModels[movedItem["id"]] then
  2298.  
  2299. triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,movedItem["id"],movedItem["value"],movedItem["dbid"])
  2300.  
  2301. end
  2302.  
  2303. triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, movedItem)
  2304.  
  2305. inventoryItems[elementSource][activeSide][movedSlot] = nil
  2306.  
  2307. end
  2308.  
  2309. elseif (movedSlot > -1 and movedItem and not inAction and inMove and not inItem and clickedElement and getElementType(elementSource) == "object") and clickedElement == localPlayer and not isCursorInAction then
  2310.  
  2311. if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
  2312.  
  2313. updateClick = updateClick+1
  2314.  
  2315. triggerServerEvent("tradeItem", localPlayer, localPlayer, localPlayer, elementSource, movedItem,updateClick)
  2316.  
  2317. end
  2318.  
  2319. elseif (movedSlot > -1 and movedItem and not inAction and inMove and not inItem and clickedElement and getElementType(elementSource) == "vehicle") and clickedElement == localPlayer and not isCursorInAction then
  2320.  
  2321. if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
  2322.  
  2323. updateClick = updateClick+1
  2324.  
  2325. triggerServerEvent("tradeItem", localPlayer, localPlayer, localPlayer, elementSource, movedItem,updateClick)
  2326.  
  2327. end
  2328.  
  2329. elseif (movedSlot > -1 and movedItem and not inAction and inMove and not inItem and clickedElement and getElementType(clickedElement) == "object") and getElementData(clickedElement, "szef") and clickedElement ~= localPlayer and not isCursorInAction then
  2330.  
  2331. if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
  2332.  
  2333. if movedItem["duty"] == 1 then
  2334.  
  2335. outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
  2336.  
  2337. else
  2338.  
  2339. if movedItem["id"] ~= 93 then
  2340.  
  2341. if hasItem(153, getElementData(clickedElement, "dbid")) then
  2342.  
  2343. updateClick = updateClick+1
  2344.  
  2345. triggerServerEvent("tradeItem", localPlayer, localPlayer, clickedElement, elementSource, movedItem,updateClick)
  2346.  
  2347. else
  2348.  
  2349. outputChatBox("[RiseMTA]:#ffffff Nincs kulcsod ehhez a széfhez.",172, 211, 115,true)
  2350.  
  2351. end
  2352.  
  2353. else
  2354.  
  2355. outputChatBox("[RiseMTA]:#ffffff A kiválasztott tárgyat, csak egy másik játékosnak tudod átadni.",172, 211, 115,true)
  2356.  
  2357. end
  2358.  
  2359. end
  2360.  
  2361. end
  2362.  
  2363. end
  2364.  
  2365. hideMove()
  2366.  
  2367. elseif (pButton == "right" and pState == "down" and showInventory and not inMove and movedSlot < 0) then
  2368.  
  2369. if hoverSlot >=1 then
  2370.  
  2371. if hoverItem then
  2372.  
  2373. if elementSource == localPlayer then
  2374.  
  2375. if getKeyState("lctrl") then
  2376.  
  2377. if hasItem(175) then
  2378.  
  2379. if hoverItem["id"] ~= 175 then
  2380.  
  2381. if not getItemStackable(hoverItem["id"]) then
  2382.  
  2383. if not showNameBar then
  2384.  
  2385. showNameBar = true
  2386.  
  2387. showNameSlot = hoverSlot
  2388.  
  2389. local curX, curY = getCursorFuck()
  2390.  
  2391. namePos[1],namePos[2] = curX, curY
  2392.  
  2393. if not isElement(nameGui) then
  2394.  
  2395. nameGui = guiCreateEdit (-1000,-1000,0,0,"",false)
  2396.  
  2397. guiSetAlpha(nameGui,0)
  2398.  
  2399. end
  2400.  
  2401. end
  2402.  
  2403. else
  2404.  
  2405. outputChatBox("[RiseMTA]:#ffffff Csak olyan tárgyat nevezhetsz át amit nem lehet stack-elni.",172, 211, 115,true)
  2406.  
  2407. end
  2408.  
  2409. else
  2410.  
  2411. outputChatBox("[RiseMTA]:#ffffff Névtáblát nem nevezhetsz át.",1,122,188,true)
  2412.  
  2413. end
  2414.  
  2415. end
  2416.  
  2417. else
  2418.  
  2419. useItem(hoverItem,hoverSlot)
  2420.  
  2421. end
  2422.  
  2423. end
  2424.  
  2425. end
  2426.  
  2427. end
  2428.  
  2429.  
  2430.  
  2431. elseif (pButton == "right" and pState == "up" and showInventory) then
  2432.  
  2433. end
  2434.  
  2435. if (pButton == "right" and pState == "down") then
  2436.  
  2437. if (clickedElement and getElementType(clickedElement) == "vehicle" and (tonumber(getElementData(clickedElement, "veh:id") or 0) > 0 or getElementData(clickedElement, 'rentboat:id'))) then -- Kocsi
  2438.  
  2439. if getDistanceFromElement(localPlayer, clickedElement) < 3.5 then
  2440.  
  2441. if showInventory then
  2442.  
  2443. if isInBox(moveX-4,moveY-16,pW+12,pH+64) then
  2444.  
  2445. return
  2446.  
  2447. end
  2448.  
  2449. end
  2450.  
  2451. if isPedInVehicle(localPlayer) then return end
  2452.  
  2453. if not getElementData(localPlayer,"mechanicing") then
  2454.  
  2455. if (isVehicleLocked(clickedElement)) then
  2456.  
  2457. outputChatBox("[RiseMTA]:#ffffff A kiválasztott jármű csomagtartója zárva van.",172, 211, 115,true)
  2458.  
  2459. else
  2460.  
  2461. if getElementData(clickedElement,"veh:use") then
  2462.  
  2463. outputChatBox("[RiseMTA]:#ffffff A kiválasztott jármű csomagtartója használatban van.",172, 211, 115,true)
  2464.  
  2465. else
  2466.  
  2467. showInventory = true
  2468.  
  2469. invMenu = 1
  2470.  
  2471. activeSide = "vehicle"
  2472.  
  2473. elementSource = clickedElement
  2474.  
  2475. setElementData(clickedElement, "veh:player", localPlayer)
  2476.  
  2477. setElementData(clickedElement, "veh:use", true)
  2478.  
  2479. triggerServerEvent("getElementItems", localPlayer, localPlayer, clickedElement, 2)
  2480.  
  2481. if not isElement(amountBox) then
  2482.  
  2483. amountBox = guiCreateEdit (-1000,-1000,0,0,"",false)
  2484.  
  2485. guiSetAlpha(amountBox,0)
  2486.  
  2487. end
  2488.  
  2489. setElementData(localPlayer,"show:inv",clickedElement)
  2490.  
  2491.  
  2492.  
  2493. triggerServerEvent("doorState", localPlayer, clickedElement, 1)
  2494.  
  2495. exports["rise_chat"]:sendLocalMeMessage(localPlayer,"belenézett egy jármű csomagtartójába.")
  2496.  
  2497.  
  2498.  
  2499. end
  2500.  
  2501. end
  2502.  
  2503. end
  2504.  
  2505. end
  2506.  
  2507. end
  2508.  
  2509. if (clickedElement and getElementType(clickedElement) == "object" and tonumber(getElementData(clickedElement, "dbid") or 0) > 0) then -- Széf
  2510.  
  2511. if getDistanceFromElement(localPlayer, clickedElement) < 3.5 then
  2512.  
  2513. if showInventory then
  2514.  
  2515. if isInBox(moveX-4,moveY-16,pW+12,pH+64) then
  2516.  
  2517. return
  2518.  
  2519. end
  2520.  
  2521. end
  2522.  
  2523. if getElementData(clickedElement,"szef") then
  2524.  
  2525. if hasItem(153,getElementData(clickedElement, "dbid")) then
  2526.  
  2527. if getElementData(clickedElement,"safe:use") then
  2528.  
  2529. outputChatBox("[RiseMTA]:#ffffff A kiválasztott széf használatban van.",172, 211, 115,true)
  2530.  
  2531. else
  2532.  
  2533. showInventory = true
  2534.  
  2535. invMenu = 1
  2536.  
  2537. activeSide = "object"
  2538.  
  2539. elementSource = clickedElement
  2540.  
  2541. triggerServerEvent("getElementItems", localPlayer, localPlayer, clickedElement, 2)
  2542.  
  2543. if not isElement(amountBox) then
  2544.  
  2545. amountBox = guiCreateEdit (-1000,-1000,0,0,"",false)
  2546.  
  2547. guiSetAlpha(amountBox,0)
  2548.  
  2549. end
  2550.  
  2551. setElementData(localPlayer,"show:inv",clickedElement)
  2552.  
  2553. setElementData(clickedElement,"safe:use",true)
  2554.  
  2555. setElementData(clickedElement,"safe:player",localPlayer)
  2556.  
  2557. exports["rise_chat"]:sendLocalMeMessage(localPlayer,"belenézett egy széfbe.")
  2558.  
  2559. end
  2560.  
  2561. else
  2562.  
  2563. if activeSide ~= "object" then
  2564.  
  2565. outputChatBox("[RiseMTA]:#ffffff Nincs kulcsod ehhez a széfhez.",172, 211, 115,true)
  2566.  
  2567. end
  2568.  
  2569. end
  2570.  
  2571. end
  2572.  
  2573. end
  2574.  
  2575. end
  2576.  
  2577. end
  2578.  
  2579. end
  2580.  
  2581. end
  2582.  
  2583. addEventHandler("onClientClick", getRootElement(),func["invClick"])
  2584.  
  2585.  
  2586.  
  2587. function removeDecimal(number)
  2588.  
  2589. local num = number
  2590.  
  2591. local num2 = tostring(num)
  2592.  
  2593. local found = nil
  2594.  
  2595. for i=1,100000 do
  2596.  
  2597. if string.sub(num2,i,i) == "." then
  2598.  
  2599. found = i
  2600.  
  2601. end
  2602.  
  2603. end
  2604.  
  2605. if type(found) == "number" then
  2606.  
  2607. num2 = string.sub(num2,1,found-1)
  2608.  
  2609. end
  2610.  
  2611. num = tonumber(num2)
  2612.  
  2613. return num
  2614.  
  2615. end
  2616.  
  2617.  
  2618.  
  2619. addEventHandler("onClientGUIChanged", getRootElement(),function()
  2620.  
  2621. if source == amountBox then
  2622.  
  2623. local currentAmount = guiGetText (source)
  2624.  
  2625. if string.len(currentAmount) > 0 then
  2626.  
  2627. local am = tonumber(currentAmount)
  2628.  
  2629. if am then
  2630.  
  2631. selectedAmount = removeDecimal(am)
  2632.  
  2633. else
  2634.  
  2635. guiSetText(source, currentAmount)
  2636.  
  2637. end
  2638.  
  2639. else
  2640.  
  2641. --guiSetText(source, 0)
  2642.  
  2643. --selectedAmount = 0
  2644.  
  2645. end
  2646.  
  2647. end
  2648.  
  2649. end)
  2650.  
  2651.  
  2652.  
  2653. function outputPressedCharacter(character)
  2654.  
  2655. if showInventory and inAmountBox and #amountTable < 3 then
  2656.  
  2657. if (character == "0" or character == "1" or character == "2" or character == "3" or character == "4" or character == "5" or character == "6" or character == "7" or character == "8" or character == "9") then
  2658.  
  2659. amountTable[#amountTable + 1] = character
  2660.  
  2661. selectedAmount = removeDecimal(table.concat(amountTable))
  2662.  
  2663. end
  2664.  
  2665. end
  2666.  
  2667.  
  2668.  
  2669. end
  2670.  
  2671. addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter)
  2672.  
  2673.  
  2674.  
  2675. addEventHandler("onClientKey", getRootElement(),
  2676.  
  2677. function(k, v)
  2678.  
  2679. if not (v) then
  2680.  
  2681. return
  2682.  
  2683. end
  2684.  
  2685. if (showInventory) then
  2686.  
  2687. if (k == "backspace") then
  2688.  
  2689. table.remove(amountTable, #amountTable)
  2690.  
  2691. end
  2692.  
  2693. end
  2694.  
  2695. end
  2696.  
  2697. )
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703. function createNewItem(newSlot, itemDBID, itemID, itemValue, itemCount, itemDuty, itemHealth,itemName,weaponSerial)
  2704.  
  2705. if (newSlot > -1 and itemDBID and itemID and itemValue and itemCount and itemDuty and itemHealth) then
  2706.  
  2707. triggerServerEvent("createNewItem", localPlayer, localPlayer, elementSource, itemID, newSlot,itemCount,itemDuty,itemValue,itemHealth,itemName,weaponSerial,itemDBID)
  2708.  
  2709. end
  2710.  
  2711. end
  2712.  
  2713.  
  2714.  
  2715. function setItemCount(itemSlot, newCount)
  2716.  
  2717. if (itemSlot > -1 and newCount > -1) then
  2718.  
  2719. if activeSide == "craft" then
  2720.  
  2721. newMenu = "bag"
  2722.  
  2723. else
  2724.  
  2725. newMenu = activeSide
  2726.  
  2727. end
  2728.  
  2729. triggerServerEvent("updateItemCount", localPlayer, localPlayer, elementSource, itemSlot, newCount,inventoryItems[elementSource][newMenu][itemSlot])
  2730.  
  2731. inventoryItems[elementSource][newMenu][itemSlot]["count"] = newCount
  2732.  
  2733. if (elementSource == localPlayer) then
  2734.  
  2735. playerItems[elementSource][newMenu][itemSlot]["count"] = newCount
  2736.  
  2737. end
  2738.  
  2739. end
  2740.  
  2741. end
  2742.  
  2743.  
  2744.  
  2745. function setItemName(itemSlot, newName)
  2746.  
  2747. if (itemSlot > -1 and newName) then
  2748.  
  2749. if activeSide == "craft" then
  2750.  
  2751. newMenu = "bag"
  2752.  
  2753. else
  2754.  
  2755. newMenu = activeSide
  2756.  
  2757. end
  2758.  
  2759. triggerServerEvent("updateItemName", localPlayer, localPlayer, elementSource, itemSlot, newName, inventoryItems[elementSource][newMenu][itemSlot])
  2760.  
  2761.  
  2762.  
  2763. inventoryItems[elementSource][newMenu][itemSlot]["name"] = newName
  2764.  
  2765. if (elementSource == localPlayer) then
  2766.  
  2767. playerItems[elementSource][newMenu][itemSlot]["name"] = newName
  2768.  
  2769. end
  2770.  
  2771. end
  2772.  
  2773. end
  2774.  
  2775.  
  2776.  
  2777. function setItemValue(itemSlot, newCount)
  2778.  
  2779. if (itemSlot > -1 and newCount > -1) then
  2780.  
  2781. if activeSide == "craft" then
  2782.  
  2783. newMenu = "bag"
  2784.  
  2785. else
  2786.  
  2787. newMenu = activeSide
  2788.  
  2789. end
  2790.  
  2791. triggerServerEvent("updateItemValue", localPlayer, localPlayer, elementSource, itemSlot, newCount, inventoryItems[elementSource][newMenu][itemSlot])
  2792.  
  2793.  
  2794.  
  2795. inventoryItems[elementSource][newMenu][itemSlot]["value"] = newCount
  2796.  
  2797. if (elementSource == localPlayer) then
  2798.  
  2799. playerItems[elementSource][newMenu][itemSlot]["value"] = newCount
  2800.  
  2801. end
  2802.  
  2803. end
  2804.  
  2805. end
  2806.  
  2807.  
  2808.  
  2809. function delItemSlot(itemSlot)
  2810.  
  2811. if (itemSlot > -1) then
  2812.  
  2813. inventoryItems[elementSource][activeSide][itemSlot] = nil
  2814.  
  2815. if (elementSource == localPlayer) then
  2816.  
  2817. playerItems[elementSource][activeSide][itemSlot] = nil
  2818.  
  2819. end
  2820.  
  2821. end
  2822.  
  2823. end
  2824.  
  2825.  
  2826.  
  2827. function getAllItemWeight()
  2828.  
  2829. local bagWeight = 0
  2830.  
  2831. local keyWeight = 0
  2832.  
  2833. local vehWeight = 0
  2834.  
  2835. local objectWeight = 0
  2836.  
  2837. if isElement(elementSource) then
  2838.  
  2839. if getElementType(elementSource) == "player" then
  2840.  
  2841. if inventoryItems[elementSource]["bag"] then
  2842.  
  2843. for i = 1, row * column do
  2844.  
  2845. if (inventoryItems[elementSource]["bag"][i]) then
  2846.  
  2847. bagWeight = bagWeight + (getItemWeight(inventoryItems[elementSource]["bag"][i]["id"]) * inventoryItems[elementSource]["bag"][i]["count"])
  2848.  
  2849. end
  2850.  
  2851. end
  2852.  
  2853. end
  2854.  
  2855. if inventoryItems[elementSource]["key"] then
  2856.  
  2857. for i = 1, row * column do
  2858.  
  2859. if (inventoryItems[elementSource]["key"][i]) then
  2860.  
  2861. keyWeight = keyWeight + (getItemWeight(inventoryItems[elementSource]["key"][i]["id"]) * inventoryItems[elementSource]["key"][i]["count"])
  2862.  
  2863. end
  2864.  
  2865. end
  2866.  
  2867. end
  2868.  
  2869. end
  2870.  
  2871. if getElementType(elementSource) == "vehicle" then
  2872.  
  2873. if inventoryItems[elementSource] then
  2874.  
  2875. if inventoryItems[elementSource]["vehicle"] then
  2876.  
  2877. for i = 1, row * column do
  2878.  
  2879. if (inventoryItems[elementSource]["vehicle"][i]) then
  2880.  
  2881. vehWeight = vehWeight + (getItemWeight(inventoryItems[elementSource]["vehicle"][i]["id"]) * inventoryItems[elementSource]["vehicle"][i]["count"])
  2882.  
  2883. end
  2884.  
  2885. end
  2886.  
  2887. end
  2888.  
  2889. end
  2890.  
  2891. end
  2892.  
  2893. if getElementType(elementSource) == "object" then
  2894.  
  2895. if inventoryItems[elementSource]["object"] then
  2896.  
  2897. for i = 1, row * column do
  2898.  
  2899. if (inventoryItems[elementSource]["object"][i]) then
  2900.  
  2901. objectWeight = objectWeight + (getItemWeight(inventoryItems[elementSource]["object"][i]["id"]) * inventoryItems[elementSource]["object"][i]["count"])
  2902.  
  2903. end
  2904.  
  2905. end
  2906.  
  2907. end
  2908.  
  2909. end
  2910.  
  2911. end
  2912.  
  2913. return bagWeight + keyWeight + vehWeight + objectWeight
  2914.  
  2915. end
  2916.  
  2917.  
  2918.  
  2919. function delItem(itemSlot,state)
  2920.  
  2921. if not state then
  2922.  
  2923. state = 0
  2924.  
  2925. end
  2926.  
  2927. if (itemSlot > -1) then
  2928.  
  2929. if activeSide == "craft" then
  2930.  
  2931. newMenu = "bag"
  2932.  
  2933. else
  2934.  
  2935. newMenu = activeSide
  2936.  
  2937. end
  2938.  
  2939.  
  2940.  
  2941. if state == 0 then
  2942.  
  2943. if getElementType(elementSource) == "player" then
  2944.  
  2945. for i=1, actionSlots do
  2946.  
  2947. if actionBarItems[elementSource][i] then
  2948.  
  2949. if actionBarItems[elementSource][i][1] == inventoryItems[elementSource][newMenu][itemSlot]["dbid"] then
  2950.  
  2951. triggerServerEvent("deleteActionBarItem",localPlayer,localPlayer,i)
  2952.  
  2953. actionBarItems[elementSource][i][1] = {-1,-1,""}
  2954.  
  2955. end
  2956.  
  2957. end
  2958.  
  2959. end
  2960.  
  2961. end
  2962.  
  2963. end
  2964.  
  2965.  
  2966.  
  2967. triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, inventoryItems[elementSource][newMenu][itemSlot],state)
  2968.  
  2969. inventoryItems[elementSource][newMenu][itemSlot] = nil
  2970.  
  2971. if (elementSource == localPlayer) then
  2972.  
  2973. playerItems[elementSource][newMenu][itemSlot] = nil
  2974.  
  2975. end
  2976.  
  2977. end
  2978.  
  2979. end
  2980.  
  2981.  
  2982.  
  2983. function takeStatus(itemSlot, statusMinus)
  2984.  
  2985. itemSlot = tonumber(itemSlot)
  2986.  
  2987. if (itemSlot > -1) then
  2988.  
  2989. if tonumber(inventoryItems[elementSource]["bag"][itemSlot]["health"]) - tonumber(statusMinus) <= 0 then
  2990.  
  2991. triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, inventoryItems[elementSource][activeSide][itemSlot])
  2992.  
  2993. inventoryItems[elementSource][activeSide][itemSlot] = nil
  2994.  
  2995. if (elementSource == localPlayer) then
  2996.  
  2997. playerItems[elementSource][activeSide][itemSlot] = nil
  2998.  
  2999. end
  3000.  
  3001. local activeItemID = getElementData(localPlayer,"active:itemID")
  3002.  
  3003. local activeitemSlot = getElementData(localPlayer,"active:itemSlot")
  3004.  
  3005. local activeWeapSlot = getElementData(localPlayer,"active:weaponSlot")
  3006.  
  3007. if(activeItemID>-1) and (activeitemSlot>-1) then
  3008.  
  3009. if activeWeaponSlot == itemSlot then
  3010.  
  3011. activeWeaponSlot = -1
  3012.  
  3013. activeAmmoSlot = - 1
  3014.  
  3015. setElementData(localPlayer,"active:weaponSlot",-1)
  3016.  
  3017. setElementData(localPlayer,"active:itemID",-1)
  3018.  
  3019. setElementData(localPlayer,"active:itemSlot",-1)
  3020.  
  3021. triggerServerEvent("elveszfegyot",localPlayer,localPlayer)
  3022.  
  3023. end
  3024.  
  3025. end
  3026.  
  3027. return
  3028.  
  3029. else
  3030.  
  3031. triggerServerEvent("takeStatus", localPlayer, localPlayer, elementSource, inventoryItems[elementSource]["bag"][itemSlot], tonumber(inventoryItems[elementSource]["bag"][itemSlot]["health"]) - statusMinus)
  3032.  
  3033. inventoryItems[elementSource]["bag"][itemSlot]["health"] = tonumber(inventoryItems[elementSource]["bag"][itemSlot]["health"]) - statusMinus
  3034.  
  3035. return
  3036.  
  3037. end
  3038.  
  3039. end
  3040.  
  3041. end
  3042.  
  3043.  
  3044.  
  3045. function takeItem(item)
  3046.  
  3047. local elem = 0
  3048.  
  3049. if activeSide == "craft" then
  3050.  
  3051. thisMenu = "bag"
  3052.  
  3053. else
  3054.  
  3055. thisMenu = activeSide
  3056.  
  3057. end
  3058.  
  3059. for i = 1, row * column do
  3060.  
  3061. if (inventoryItems[elementSource][thisMenu][i]) then
  3062.  
  3063. if item == inventoryItems[elementSource][thisMenu][i]["id"] then
  3064.  
  3065. elem = elem+1
  3066.  
  3067. if elem == 1 then
  3068.  
  3069. if inventoryItems[elementSource][thisMenu][i]["count"] > 1 then
  3070.  
  3071. setItemCount(i,inventoryItems[elementSource][thisMenu][i]["count"]-1)
  3072.  
  3073. else
  3074.  
  3075. delItem(i)
  3076.  
  3077. end
  3078.  
  3079. end
  3080.  
  3081. end
  3082.  
  3083. end
  3084.  
  3085. end
  3086.  
  3087. end
  3088.  
  3089. addEvent("takeItemServer",true)
  3090.  
  3091. addEventHandler("takeItemServer",getRootElement(),takeItem)
  3092.  
  3093.  
  3094.  
  3095. function setItemSlot(oldSlot, newSlot)
  3096.  
  3097. if (oldSlot > -1 and newSlot > -1) then
  3098.  
  3099. inventoryItems[elementSource][activeSide][newSlot] = inventoryItems[elementSource][activeSide][oldSlot]
  3100.  
  3101. if (elementSource == localPlayer) then
  3102.  
  3103. playerItems[elementSource][activeSide][newSlot] = inventoryItems[elementSource][activeSide][oldSlot]
  3104.  
  3105. end
  3106.  
  3107. updateClick = updateClick+1
  3108.  
  3109. triggerServerEvent("updateItemSlot", localPlayer, localPlayer, elementSource, newSlot, inventoryItems[elementSource][activeSide][oldSlot],oldSlot,updateClick)
  3110.  
  3111. end
  3112.  
  3113. end
  3114.  
  3115.  
  3116.  
  3117. function hideMove()
  3118.  
  3119. startTick = -1
  3120.  
  3121. movedItem = nil
  3122.  
  3123. movedSlot = -1
  3124.  
  3125. inMove = false
  3126.  
  3127. end
  3128.  
  3129.  
  3130.  
  3131. function hideClone()
  3132.  
  3133. clonedItem = nil
  3134.  
  3135. clonedSlot = -1
  3136.  
  3137. inClone = false
  3138.  
  3139. end
  3140.  
  3141.  
  3142.  
  3143. function hasActionItem(actionItem)
  3144.  
  3145. hasTheItem = false
  3146.  
  3147. if (actionItem) then
  3148.  
  3149. if (playerItems[elementSource]["bag"] and playerItems[elementSource]["key"]) then
  3150.  
  3151. for i = 1, row * column do
  3152.  
  3153. if (playerItems[elementSource]["bag"][i]) then
  3154.  
  3155. if (actionItem["dbid"] == playerItems[elementSource]["bag"][i]["dbid"]) then
  3156.  
  3157. hasTheItem = true
  3158.  
  3159. end
  3160.  
  3161. end
  3162.  
  3163. end
  3164.  
  3165. for i = 1, row * column do
  3166.  
  3167. if (playerItems[elementSource]["key"][i]) then
  3168.  
  3169. if (actionItem["dbid"] == playerItems[elementSource]["key"][i]["dbid"]) then
  3170.  
  3171. hasTheItem = true
  3172.  
  3173. end
  3174.  
  3175. end
  3176.  
  3177. end
  3178.  
  3179. if hasTheItem then
  3180.  
  3181. return true
  3182.  
  3183. else
  3184.  
  3185. return false
  3186.  
  3187. end
  3188.  
  3189. return false
  3190.  
  3191. end
  3192.  
  3193. return false
  3194.  
  3195. end
  3196.  
  3197. return false
  3198.  
  3199. end
  3200.  
  3201.  
  3202.  
  3203. function giveItem(itemID, itemValue, itemCount, itemDuty)
  3204.  
  3205. triggerServerEvent("giveItem", localPlayer, localPlayer, itemID, itemValue, itemCount, itemDuty)
  3206.  
  3207. end
  3208.  
  3209.  
  3210.  
  3211. function hasItem(itemID, itemValue)
  3212.  
  3213. if (not itemValue) then
  3214.  
  3215. if (playerItems[elementSource]["bag"] and playerItems[elementSource]["key"] and getElementType(elementSource) == "player") then
  3216.  
  3217. for i = 1, row * column do
  3218.  
  3219. if (playerItems[elementSource]["bag"][i]) then
  3220.  
  3221. if (itemID == playerItems[elementSource]["bag"][i]["id"]) then
  3222.  
  3223. return true, itemID, itemValue, i, "bag", countItemsInInventory(itemID),playerItems[elementSource]["bag"][i]["count"]
  3224.  
  3225. end
  3226.  
  3227. end
  3228.  
  3229. end
  3230.  
  3231. for i = 1, row * column do
  3232.  
  3233. if (playerItems[elementSource]["key"][i]) then
  3234.  
  3235. if (itemID == playerItems[elementSource]["key"][i]["id"]) then
  3236.  
  3237. return true, itemID, itemValue, i, "key"
  3238.  
  3239. end
  3240.  
  3241. end
  3242.  
  3243. end
  3244.  
  3245. return false
  3246.  
  3247. end
  3248.  
  3249. return false
  3250.  
  3251. else
  3252.  
  3253. if (playerItems[elementSource]["bag"] and playerItems[elementSource]["key"] and getElementType(elementSource) == "player") then
  3254.  
  3255. for i = 1, row * column do
  3256.  
  3257. if (playerItems[elementSource]["bag"][i]) then
  3258.  
  3259. if (itemID == playerItems[elementSource]["bag"][i]["id"] and tonumber(itemValue) == tonumber(playerItems[elementSource]["bag"][i]["value"])) then
  3260.  
  3261. return true, itemID, tonumber(itemValue), i
  3262.  
  3263. end
  3264.  
  3265. end
  3266.  
  3267. end
  3268.  
  3269. for i = 1, row * column do
  3270.  
  3271. if (playerItems[elementSource]["key"][i]) then
  3272.  
  3273. if (itemID == playerItems[elementSource]["key"][i]["id"] and tonumber(itemValue) == tonumber(playerItems[elementSource]["key"][i]["value"])) then
  3274.  
  3275. return true, itemID, tonumber(itemValue), i
  3276.  
  3277. end
  3278.  
  3279. end
  3280.  
  3281. end
  3282.  
  3283. return false
  3284.  
  3285. end
  3286.  
  3287. return false
  3288.  
  3289. end
  3290.  
  3291. return false
  3292.  
  3293. end
  3294.  
  3295.  
  3296.  
  3297. --[[setTimer(function()
  3298.  
  3299. if (playerItems[elementSource]["licens"]) then
  3300.  
  3301. for i = 1, row * column do
  3302.  
  3303. if (playerItems[elementSource]["licens"][i]) then
  3304.  
  3305. if (playerItems[elementSource]["licens"][i]["id"] ==147) then
  3306.  
  3307. if (i > -1) then
  3308.  
  3309. if tonumber(inventoryItems[elementSource]["licens"][i]["health"]) - 1 <= 0 then
  3310.  
  3311. triggerServerEvent("takeTicket",localPlayer,localPlayer,tonumber(inventoryItems[elementSource]["licens"][i]["value"]))
  3312.  
  3313. triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, inventoryItems[elementSource]["licens"][i])
  3314.  
  3315. inventoryItems[elementSource]["licens"][i] = nil
  3316.  
  3317. if (elementSource == localPlayer) then
  3318.  
  3319. playerItems[elementSource]["licens"][i] = nil
  3320.  
  3321. end
  3322.  
  3323. else
  3324.  
  3325. triggerServerEvent("takeStatus", localPlayer, localPlayer, localPlayer, inventoryItems[elementSource]["licens"][i], tonumber(inventoryItems[elementSource]["licens"][i]["health"]) - 1)
  3326.  
  3327. inventoryItems[elementSource]["licens"][i]["health"] = tonumber(inventoryItems[elementSource]["licens"][i]["health"]) - 1
  3328.  
  3329. if inventoryItems[elementSource]["licens"][i]["health"] == 5 then
  3330.  
  3331. outputChatBox("[RiseMTA]:#ffffff Hamarosan le fog járni a befizetési határidőd. (#3d7abc5#ffffff perc)",172, 211, 115,true)
  3332.  
  3333. end
  3334.  
  3335. end
  3336.  
  3337. end
  3338.  
  3339. end
  3340.  
  3341. end
  3342.  
  3343. end
  3344.  
  3345. end
  3346.  
  3347. end,60000,0)--]]
  3348.  
  3349.  
  3350.  
  3351. function countItemsInInventory(itemID, count)
  3352.  
  3353. if (playerItems[elementSource]["bag"]) then
  3354.  
  3355. local count = 0
  3356.  
  3357. for i = 1, row * column do
  3358.  
  3359. if (playerItems[elementSource]["bag"][i]) then
  3360.  
  3361. if (itemID == playerItems[elementSource]["bag"][i]["id"]) then
  3362.  
  3363. count = count + 1
  3364.  
  3365. end
  3366.  
  3367. end
  3368.  
  3369. end
  3370.  
  3371. return count
  3372.  
  3373. end
  3374.  
  3375. return false
  3376.  
  3377. end
  3378.  
  3379.  
  3380.  
  3381. function hasItemOnSlot(slot)
  3382.  
  3383. if (playerItems[elementSource]["bag"][slot] and tonumber(playerItems[elementSource]["bag"][slot]["id"] or -1) > -1) then
  3384.  
  3385. return true
  3386.  
  3387. end
  3388.  
  3389. return false
  3390.  
  3391. end
  3392.  
  3393.  
  3394.  
  3395. function isInBox(xS,yS,wS,hS)
  3396.  
  3397. if(isCursorShowing()) then
  3398.  
  3399. local cursorX, cursorY = getCursorPosition()
  3400.  
  3401. cursorX, cursorY = cursorX*sX, cursorY*sY
  3402.  
  3403. if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then
  3404.  
  3405. return true
  3406.  
  3407. else
  3408.  
  3409. return false
  3410.  
  3411. end
  3412.  
  3413. end
  3414.  
  3415. end
  3416.  
  3417.  
  3418.  
  3419. function getDistanceFromElement(from, to)
  3420.  
  3421. if not from or not to then return end
  3422.  
  3423. local x, y, z = getElementPosition(from)
  3424.  
  3425. local x1, y1, z1 = getElementPosition(to)
  3426.  
  3427. return getDistanceBetweenPoints3D(x, y, z, x1, y1, z1)
  3428.  
  3429. end
  3430.  
  3431.  
  3432.  
  3433. addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(),function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
  3434.  
  3435. local activeItemID = getElementData(localPlayer,"active:itemID")
  3436.  
  3437. local activeitemSlot = getElementData(localPlayer,"active:itemSlot")
  3438.  
  3439. if(activeItemID>-1) and (activeitemSlot>-1) then
  3440.  
  3441. local witem = tonumber(getElementData(localPlayer,"active:itemID"))
  3442.  
  3443. local wslot = tonumber(getElementData(localPlayer,"active:itemSlot"))
  3444.  
  3445. if (items[witem].isWeapon) then
  3446.  
  3447. if(tonumber(playerItems[localPlayer]["bag"][wslot]["count"] or -1)<=1)then
  3448.  
  3449. activeWeaponSlot = -1
  3450.  
  3451. activeAmmoSlot = - 1
  3452.  
  3453. delItem(wslot)
  3454.  
  3455. setElementData(localPlayer,"active:itemID",-1)
  3456.  
  3457. setElementData(localPlayer,"active:itemSlot",-1)
  3458.  
  3459. else
  3460.  
  3461. setItemCount(wslot,playerItems[localPlayer]["bag"][wslot]["count"]-1)
  3462.  
  3463. end
  3464.  
  3465. if hotTable[getPedWeapon(localPlayer)] then
  3466.  
  3467. randState = math.random(1,7)
  3468.  
  3469. weaponHot = weaponHot+hotTable[getPedWeapon(localPlayer)]
  3470.  
  3471. setElementData(localPlayer,"weap:hot",getElementData(localPlayer,"weap:hot")+hotTable[getPedWeapon(localPlayer)])
  3472.  
  3473. end
  3474.  
  3475. end
  3476.  
  3477. end
  3478.  
  3479. end)
  3480.  
  3481.  
  3482.  
  3483. addEvent("activeWeapon",true)
  3484.  
  3485. addEventHandler("activeWeapon",getRootElement(),function(slot)
  3486.  
  3487. activeWeaponSlot = slot
  3488.  
  3489. end)
  3490.  
  3491.  
  3492.  
  3493. function deleteActiveIdentitySlot()
  3494.  
  3495. if activeIdentity >= 1 then
  3496.  
  3497. delItem(activeIdentity)
  3498.  
  3499. activeIdentity = -1
  3500.  
  3501. end
  3502.  
  3503. end
  3504.  
  3505.  
  3506.  
  3507. function deleteActiveIdentity()
  3508.  
  3509. if activeIdentity >= 1 then
  3510.  
  3511. activeIdentity = -1
  3512.  
  3513. end
  3514.  
  3515. end
  3516.  
  3517.  
  3518.  
  3519. function deleteActiveBomb()
  3520.  
  3521. triggerServerEvent("deleteItem", localPlayer,localPlayer,localPlayer,inventoryItems[localPlayer]["bag"][activeBomb])
  3522.  
  3523. activeBomb = -1
  3524.  
  3525. triggerServerEvent("takeBomb",localPlayer,localPlayer)
  3526.  
  3527. setElementData(localPlayer,"hand:bomb",false)
  3528.  
  3529. end
  3530.  
  3531.  
  3532.  
  3533. if not xmlLoadFile("inventory.xml") then
  3534.  
  3535. local posF = xmlCreateFile("inventory.xml", "root")
  3536.  
  3537. local mainC = xmlCreateChild(posF, "actPos")
  3538.  
  3539. local mainC2 = xmlCreateChild(posF, "invPos")
  3540.  
  3541. xmlNodeSetValue(xmlCreateChild(mainC, "x"), actPos[1])
  3542.  
  3543. xmlNodeSetValue(xmlCreateChild(mainC, "y"), actPos[2])
  3544.  
  3545. xmlNodeSetValue(xmlCreateChild(mainC, "slots"),actionSlots)
  3546.  
  3547. xmlNodeSetValue(xmlCreateChild(mainC2, "x"), moveX)
  3548.  
  3549. xmlNodeSetValue(xmlCreateChild(mainC2, "y"), moveY)
  3550.  
  3551. xmlSaveFile(posF)
  3552.  
  3553. --outputChatBox("Mivel neked nem volt xml file-od ahova menthetné most le kreáltam neked egyet.")
  3554.  
  3555. else
  3556.  
  3557. local posF = xmlLoadFile("inventory.xml")
  3558.  
  3559. local mainC = xmlFindChild(posF, "actPos", 0)
  3560.  
  3561. local mainC2 = xmlFindChild(posF, "invPos", 0)
  3562.  
  3563. setElementData(localPlayer, "act:x", tonumber(xmlNodeGetValue(xmlFindChild(mainC, "x", 0))))
  3564.  
  3565. setElementData(localPlayer, "act:y", tonumber(xmlNodeGetValue(xmlFindChild(mainC, "y", 0))))
  3566.  
  3567. setElementData(localPlayer, "act:slot", tonumber(xmlNodeGetValue(xmlFindChild(mainC, "slots", 0))))
  3568.  
  3569. setElementData(localPlayer, "inv:x", tonumber(xmlNodeGetValue(xmlFindChild(mainC2, "x", 0))))
  3570.  
  3571. setElementData(localPlayer, "inv:y", tonumber(xmlNodeGetValue(xmlFindChild(mainC2, "y", 0))))
  3572.  
  3573. actPos[1] = getElementData(localPlayer, "act:x")
  3574.  
  3575. actPos[2] = getElementData(localPlayer, "act:y")
  3576.  
  3577. actionSlots = getElementData(localPlayer, "act:slot")
  3578.  
  3579.  
  3580.  
  3581. if actionSlots >= 7 then
  3582.  
  3583. plusSlot = ((actionSlots-6)*46)
  3584.  
  3585. end
  3586.  
  3587. moveX = getElementData(localPlayer, "inv:x")
  3588.  
  3589. moveY = getElementData(localPlayer, "inv:y")
  3590.  
  3591. end
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597. function savePos()
  3598.  
  3599. local posF = xmlLoadFile("inventory.xml")
  3600.  
  3601. if posF then
  3602.  
  3603. local mainC = xmlFindChild(posF, "actPos", 0)
  3604.  
  3605. xmlNodeSetValue(xmlFindChild(mainC, "x", 0), actPos[1])
  3606.  
  3607. xmlNodeSetValue(xmlFindChild(mainC, "y", 0), actPos[2])
  3608.  
  3609. xmlNodeSetValue(xmlFindChild(mainC, "slots", 0), actionSlots)
  3610.  
  3611. local mainC2 = xmlFindChild(posF, "invPos", 0)
  3612.  
  3613. xmlNodeSetValue(xmlFindChild(mainC2, "x", 0), moveX)
  3614.  
  3615. xmlNodeSetValue(xmlFindChild(mainC2, "y", 0), moveY)
  3616.  
  3617. xmlSaveFile(posF)
  3618.  
  3619. end
  3620.  
  3621. end
  3622.  
  3623. addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), savePos)
  3624.  
  3625. addEventHandler("onClientPlayerQuit", getRootElement(), savePos)
  3626.  
  3627.  
  3628.  
  3629. function roundedRectangle(x, y, w, h, borderColor, bgColor, loginPostGUI)
  3630.  
  3631. if (x and y and w and h) then
  3632.  
  3633. if (not borderColor) then
  3634.  
  3635. borderColor = tocolor(0, 0, 0, 255);
  3636.  
  3637. end
  3638.  
  3639. if (not bgColor) then
  3640.  
  3641. bgColor = borderColor;
  3642.  
  3643. end
  3644.  
  3645. dxDrawRectangle(x, y, w, h, bgColor, loginPostGUI);
  3646.  
  3647. dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, loginPostGUI);
  3648.  
  3649. dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, loginPostGUI);
  3650.  
  3651. dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, loginPostGUI);
  3652.  
  3653. dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, loginPostGUI);
  3654.  
  3655. end
  3656.  
  3657. end
  3658.  
  3659.  
  3660.  
  3661. function dxCreateBorder2(x,y,w,h,color)
  3662.  
  3663. dxDrawRectangle(x-2,y-2,w+4,2,color) -- Fent
  3664.  
  3665. dxDrawRectangle(x-2,y,2,h,color) -- Bal Oldal
  3666.  
  3667. dxDrawRectangle(x-2,y+h,w+4,2,color) -- Lent Oldal
  3668.  
  3669. dxDrawRectangle(x+w,y-2,2,h+2,color) -- Jobb Oldal
  3670.  
  3671. end
  3672.  
  3673.  
  3674.  
  3675. function dxCreateBorder(x,y,w,h,color)
  3676.  
  3677. dxDrawRectangle(x,y-1,w,1,color)
  3678.  
  3679. dxDrawRectangle(x,y+h,w,1,color)
  3680.  
  3681. dxDrawRectangle(x-1,y-1,1,h+2,color)
  3682.  
  3683. dxDrawRectangle(x+w,y-1,1,h+2,color)
  3684.  
  3685. end
  3686.  
  3687.  
  3688.  
  3689. addEvent("updateItemClick",true)
  3690.  
  3691. addEventHandler("updateItemClick",getRootElement(),function()
  3692.  
  3693. updateClick = 0
  3694.  
  3695. end)
  3696.  
  3697.  
  3698.  
  3699. _triggerServerEvent = triggerServerEvent
  3700.  
  3701. _network = 1
  3702.  
  3703. _networkS = 1
  3704.  
  3705.  
  3706.  
  3707. addEventHandler('onClientPlayerNetworkStatus', root, function(s)
  3708.  
  3709. _networkS = s
  3710.  
  3711. end)
  3712.  
  3713.  
  3714.  
  3715. addEventHandler('onClientRender', root, function()
  3716.  
  3717. if getPlayerPing(localPlayer) < 200 then
  3718.  
  3719. _network = 1
  3720.  
  3721. else
  3722.  
  3723. _network = 0
  3724.  
  3725. end
  3726.  
  3727. end)
  3728.  
  3729.  
  3730.  
  3731.  
  3732.  
  3733. function triggerServerEvent(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
  3734.  
  3735. if a == 'tradeItem' then
  3736.  
  3737. if _network == 1 and _networkS == 1 then
  3738.  
  3739. _triggerServerEvent(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
  3740.  
  3741. else
  3742.  
  3743. outputChatBox('#DC143C[RiseMTA]:#FFFFFF Hálózati hiba miatt a művelet nem hajtható végre.', 0, 0, 0, true)
  3744.  
  3745. end
  3746.  
  3747. else
  3748.  
  3749. _triggerServerEvent(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z)
  3750.  
  3751. end
  3752.  
  3753. end
Add Comment
Please, Sign In to add comment