Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local func = {}
- sX, sY = guiGetScreenSize()
- pW, pH = 461, 246
- s = {guiGetScreenSize()}
- moveX, moveY = s[1]/1.2 -pW/2,s[2]/2 - pH/2
- showInventory = false
- local showLeft = false
- local categoryFont = dxCreateFont("files/opensans.ttf",13, true)
- local usedFont = dxCreateFont("files/Roboto.ttf",11)
- local weightFont = dxCreateFont("files/Roboto.ttf",9)
- local toolfont = dxCreateFont("files/Roboto.ttf", 9)
- local font = dxCreateFont("files/Roboto.ttf", 10)
- local lastClick = 0
- local invMenu = 1
- local selectedAmount = 1
- local amountBox = nil
- local amountTable = {}
- local doBlind = 0
- local inAmountBox = false
- local inSlotBox = false
- local showBar = true
- local selectedSound = 0
- local updateClick = 0
- -- Funkció rész
- playerItems = {}
- inventoryItems = {}
- actionBarItems = {}
- usedSlots = 0
- local actionItems = {}
- elementSource = nil
- activeSide = "bag"
- newMenu = nil
- local vehBoot = false
- local hoverSlot = -1
- local hoverItem = nil
- local inMove = false
- local startTick = -1
- local movedItem = nil
- local movedSlot = -1
- local inClone = false
- local clonedItem = nil
- local clonedSlot = -1
- -- Action Bar
- local actionSlots = 6
- local isCursorInAction = false
- local current_action_slot = -1
- local isMove = false
- local isActMove = false
- defX, defY = 0,0
- barX, barY = 0,0
- actBox = {255,itemSize}
- actPos = {s[1] / 2 - 251 / 2, s[2] - (46) - 15}
- namePos = {0,0,200,28}
- local showNameBar = false
- local showNameSlot = -1
- local nameGui = nil
- local loading = 1000
- local rotate = 0
- opensans = dxCreateFont("files/opensans.ttf", 12)
- local listShow = false
- local listWheel = 0
- local searchWheel = 0
- local lastClick = 0
- activeWeaponSlot = -1
- activeAmmoSlot = -1
- activeIdentity = -1
- activeMask = -1
- activeShield = -1
- activeBadge = -1
- activePhone = -1
- activeBomb = -1
- activeBriefCase = -1
- activeCan = -1
- local searchGui = nil
- local listBox = {330,530}
- local listPos = {s[1]/2 -listBox[1]/2,s[2]/2 - listBox[2]/2}
- local addTimer
- local showActionBar = true
- addCommandHandler('togbar', function()
- showActionBar = not showActionBar
- end)
- function deleteActiveWeaponSlot()
- activeWeaponSlot = -1
- end
- hotTable = {
- --WEAPID,NUM(1-től 100-ig)
- [22] = 1.0+10, --Colt
- [23] = 1.0+11, --Silenced
- [24] = 1.0+18, -- deagle
- [25] = 1.0+27, --Shotgun
- [26] = 1.0+23, --Sawed off
- [28] = 1.0+3, --Uzi
- [29] = 1.0+4, --MP5
- [30] = 1.0+4.5, --AK
- [31] = 1.0+3.2, --M4
- [32] = 1.0+3, --TEC-9
- [33] = 1.0+23, --Rifle
- [34] = 1.0+26, --Sniper
- }
- local categoryTable = {
- {"bag","Tárgyak","bag"},
- {"key","Kulcsok","key"},
- {"craft","Barkácsolás","craft"},
- }
- addEventHandler("onClientElementDataChange",getRootElement(),function()
- if getElementData(localPlayer,"timedOut") then
- showInventory = false
- end
- end)
- function getCursorFuck()
- cX, cY = getCursorPosition()
- cX, cY = cX*sX, cY*sY
- return cX, cY
- end
- local plusSlot = 0
- addEventHandler("onClientClick",getRootElement(),function(button,state)
- if showInventory then
- if button == "left" and state == "down" then
- if isInBox(moveX,moveY,pW-76,23) then
- if not showNameBar then
- isMove = true
- local curX, curY = getCursorFuck()
- local x,y = moveX,moveY
- defX, defY = curX - x, curY - y
- end
- elseif isInBox(moveX+5,moveY+39+(hoverCategory - 1)*69,48,48) then
- if not inMove then
- if not showNameBar then
- if invMenu ~= hoverCategory then
- closeCraft()
- if categoryTable[hoverCategory] then
- playSound("files/bincoselect.mp3")
- invMenu = hoverCategory
- activeSide = categoryTable[hoverCategory][3]
- end
- end
- end
- end
- end
- if showNameBar then
- if isInBox(namePos[1]+115,namePos[2]+4,25,namePos[4]-8) then
- setItemName(showNameSlot,guiGetText(nameGui))
- outputChatBox("[RiseMTA]:#ffffff Sikeresen átneveztél egy tárgyat, egy #3D7ABC'névtábla'#ffffff használatával.",172, 211, 115,true)
- showNameBar = false
- showNameSlot = -1
- if isElement(nameGui) then
- destroyElement(nameGui)
- end
- takeItem(175)
- elseif isInBox(namePos[1]+145,namePos[2]+4,50,namePos[4]-8) then
- showNameBar = false
- showNameSlot = -1
- if isElement(nameGui) then
- destroyElement(nameGui)
- end
- end
- end
- elseif button == "left" and state == "up" then
- if isMove then
- isMove = false
- end
- end
- end
- end)
- addCommandHandler("resetinv",function()
- if getElementData(localPlayer,"loggedin") then
- if showInventory then
- moveX, moveY = s[1]/1.2 -pW/2,s[2]/2 - pH/2
- end
- end
- end)
- bindKey("i", "down",function()
- if getElementData(localPlayer, "loggedin") and not inAmountBox and not getElementData(localPlayer, "showKillPanel") and not getElementData(localPlayer, "disabled") then
- if not isTimer(addTimer) then
- closeCraft()
- openInventory(localPlayer)
- else
- outputChatBox("[RiseMTA]:#ffffff Tárgyaid betöltése folyamatban... Várj #D231312#ffffff másodpercet.",172, 211, 115,true)
- end
- end
- end)
- function openTInventory(target)
- openInventory(target)
- end
- addCommandHandler("createsafe",
- function()
- if getElementData(localPlayer, "acc:admin") >= 7 then
- if getElementInterior(localPlayer) == 0 or getElementDimension(localPlayer) == 0 then
- outputChatBox("#DC143C[RiseMTA - Széf]: #FFFFFFCsak interiorban használhatod ezt a parancsot.", 255, 255, 255, true)
- else
- triggerServerEvent("addSafeToServer",localPlayer,localPlayer)
- end
- end
- end
- )
- bindKey("delete","down",function()
- if not showInventory then return end
- if getElementData(localPlayer,"acc:admin") >= 7 then
- if getElementData(localPlayer,"char:adminduty") == 1 then
- if hoverItem then
- if hoverSlot == activeAmmoSlot then
- activeAmmoSlot = -1
- elseif hoverSlot == activeIdentity then
- activeIdentity = -1
- elseif hoverSlot == activeWeapon then
- activeWeapon = -1
- end
- if weaponModels[hoverItem["id"]] then
- triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,hoverItem["id"],hoverItem["value"],hoverItem["dbid"])
- end
- triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, hoverItem)
- inventoryItems[elementSource][activeSide][hoverSlot] = nil
- end
- end
- end
- end)
- function tooltip( text, text2 )
- if inMove then return end
- local x,y = getCursorPosition( )
- local x,y = x * sX, y * sY
- text = tostring( text )
- if text2 then
- text2 = tostring( text2 )
- end
- if text == text2 then
- text2 = nil
- end
- local width = dxGetTextWidth(text,1,"clear") - 40
- if text2 then
- width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) - 20 )
- text = text .. "\n"..text2
- end
- local height = 8 * ( text2 and 5 or 3)
- x = math.max( 10, math.min( x, sX - width - 10 ) )
- y = math.max( 10, math.min( y, sY - height - 10 ) )
- dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
- dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
- end
- function tooltipWeight( text, text2 )
- if inMove then return end
- local x,y = getCursorPosition( )
- local x,y = x * sX, y * sY
- text = tostring( text )
- if text2 then
- text2 = tostring( text2 )
- end
- if text == text2 then
- text2 = nil
- end
- local width = dxGetTextWidth(text,1,"clear")-30
- if text2 then
- width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) + 20 )
- text = text .. "\n"..text2
- end
- local height = 9* ( text2 and 5 or 3)
- x = math.max( 10, math.min( x, sX - width - 10 ) )
- y = math.max( 10, math.min( y, sY - height - 10 ) )
- dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
- dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
- end
- function tooltipWeapons( text, text2 )
- if inMove then return end
- local x,y = getCursorPosition( )
- local x,y = x * sX, y * sY
- text = tostring( text )
- if text2 then
- text2 = tostring( text2 )
- end
- if text == text2 then
- text2 = nil
- end
- local width = dxGetTextWidth( text, 1, "clear" ) - 110
- if text2 then
- width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) - 20 )
- text = text .. "\n" .. text2
- end
- local height = 11 * ( text2 and 5 or 3)
- x = math.max( 10, math.min( x, sX - width - 10 ) )
- y = math.max( 10, math.min( y, sY - height - 10 ) )
- dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
- dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
- end
- function tooltipAdmin( text, text2 )
- if inMove then return end
- local x,y = getCursorPosition( )
- local x,y = x * sX, y * sY
- text = tostring( text )
- if text2 then
- text2 = tostring( text2 )
- end
- if text == text2 then
- text2 = nil
- end
- local width = dxGetTextWidth( text, 1, "clear" ) - 100
- if text2 then
- width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) - 20 )
- text = text .. "\n" .. text2
- end
- local height = 14 * ( text2 and 5 or 3)
- x = math.max( 10, math.min( x, sX - width - 10 ) )
- y = math.max( 10, math.min( y, sY - height - 10 ) )
- dxDrawRectangle(x, y, width, height, tocolor(0,0,0,180), true);
- dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1.0, toolfont, "center", "center", false, false, true,true)
- end
- function tooltip_item( x,y,text, text2 )
- text = tostring( text )
- if text2 then
- text2 = tostring( text2 )
- end
- if text == text2 then
- text2 = nil
- end
- local width = dxGetTextWidth( text, 1, "clear" ) + 10
- if text2 then
- width = math.max( width, dxGetTextWidth( text2, 1, "clear" ) + 10 )
- text = text .. "\n" .. text2
- y = y - 20
- end
- local height = 10 * ( text2 and 4 or 2 )
- x = x - (width/1.5) + (itemSize)
- dxDrawText( text, x+28, y+78, x + width, y + height, tooltip_text_color, 0.8, font, "center", "center", false, false, false )
- end
- function openInventory(pElement)
- if (pElement) then
- showInventory = not showInventory
- triggerServerEvent("getElementItems", localPlayer, localPlayer, pElement, 2)
- activeSide = "bag"
- if showInventory then
- setElementData(localPlayer,"show:inv",pElement)
- else
- amountTable = {}
- invMenu = 1
- activeSide = "bag"
- if getElementType(elementSource) == "vehicle" then
- setElementData(elementSource, "veh:player", nil)
- setElementData(elementSource, "veh:use", false)
- triggerServerEvent("doorState", localPlayer, elementSource, 0)
- end
- if (tostring(getElementType(elementSource))=="object") then
- if getElementModel(elementSource) == 2332 then
- setElementData(elementSource,"safe:use",false)
- setElementData(elementSource,"safe:player",nil)
- end
- end
- setElementData(localPlayer,"show:inv",localPlayer)
- end
- end
- end
- addEventHandler("onClientElementDataChange", root, function(dataName, oldValue)
- if source == localPlayer then
- if dataName == "acc:id" then
- local newValue = tonumber(getElementData(source, dataName))
- if newValue > 0 then
- triggerServerEvent("getElementItems", localPlayer, localPlayer, localPlayer, 2)
- triggerServerEvent("loadActionBarItems",localPlayer,localPlayer)
- end
- end
- end
- end)
- function setElementItems(itemsTable, itemValue, pElement)
- elementSource = pElement
- if (itemValue == 2) then
- playerItems = itemsTable
- end
- if getElementType(pElement) == "vehicle" then
- if showInventory then
- elementSource = pElement
- setElementData(elementSource, "veh:player",localPlayer)
- setElementData(elementSource, "veh:use", true)
- --triggerServerEvent("doorState", localPlayer, elementSource, 0)
- else
- elementSource = localPlayer
- setElementData(pElement, "veh:player", nil)
- setElementData(pElement, "veh:use", false)
- triggerServerEvent("doorState", localPlayer, pElement, 0)
- end
- end
- if getElementType(pElement) == "object" then
- if showInventory then
- elementSource = pElement
- setElementData(elementSource,"safe:use",true)
- setElementData(elementSource,"safe:player",localPlayer)
- else
- elementSource = localPlayer
- setElementData(pElement,"safe:use",false)
- setElementData(pElement,"safe:player",nil)
- end
- end
- inventoryItems = itemsTable
- end
- addEvent("setElementItems", true)
- addEventHandler("setElementItems", getRootElement(), setElementItems)
- addEvent("actionBarEvent",true)
- addEventHandler("actionBarEvent",getRootElement(),function(loadedPlayer,tbl)
- for k,v in ipairs(tbl) do
- actionBarItems[loadedPlayer][v["actionslot"]] = {v["itemdbid"],v["item"],v["category"]}
- end
- end)
- addEvent("delActionBarSlot",true)
- addEventHandler("delActionBarSlot",getRootElement(),function(element,slot)
- actionBarItems[element][slot] = {-1, -1, ""}
- end)
- function getItemImage(itemID,value)
- value = tonumber(value)
- if (tonumber(itemID)) then
- if (itemID == 17 and value == 20) or (itemID == 17 and value == 21) then
- itempng = itemID.."_"..value
- else
- itempng = itemID
- end
- if (fileExists(":rise_item/files/items/" .. itempng .. ".png")) then
- return ":rise_item/files/items/" .. itempng .. ".png"
- end
- return ":rise_item/files/noitem.png"
- end
- return ":rise_item/files/noitem.png"
- end
- -- local inAction = false
- local inItem = false
- local actionX, actionY = sX/2 - 269/2,sY - 54 - 10
- local weaponHot = 0
- local randState = 0
- local mehet = true
- addEventHandler("onClientElementStreamIn",getRootElement(),function()
- if getElementType(source) == "player" then
- if source == localPlayer then
- if getElementData(localPlayer,"loggedin") then
- if getElementData(localPlayer,"active:itemID") == -1 then
- createClientAttachWeapons()
- end
- if getElementData(localPlayer,"isBriefCaseInHand") then
- triggerServerEvent("giveBriefCase",localPlayer,localPlayer)
- end
- end
- end
- end
- end)
- addEventHandler("onClientElementStreamOut",getRootElement(),function()
- if getElementType(source) == "player" then
- if source == localPlayer then
- if getElementData(localPlayer,"loggedin") then
- if getElementData(localPlayer,"active:itemID") == -1 then
- destroyClientAttachWeapons()
- end
- if getElementData(localPlayer,"isBriefCaseInHand") then
- triggerServerEvent("takeBriefCase",localPlayer,localPlayer)
- end
- end
- end
- end
- end)
- func.renderLoad = function()
- if getElementData(localPlayer,"loggedin") then
- --if mehet then
- --mehet = false
- removeEventHandler("onClientRender",getRootElement(),func.renderLoad)
- local count = 0
- addTimer = setTimer(function()
- triggerServerEvent("getElementItems", localPlayer, localPlayer, localPlayer, 2)
- triggerServerEvent("loadActionBarItems",localPlayer,localPlayer)
- setTimer(function()
- createClientAttachWeapons()
- end,500,1)
- end,2000,1)
- --end
- end
- end
- addEventHandler("onClientRender",getRootElement(),func.renderLoad,true,"low")
- function createClientAttachWeapons()
- if (playerItems[elementSource]["bag"]) then
- for i = 1, row * column do
- if (playerItems[elementSource]["bag"][i]) then
- if weaponModels[playerItems[elementSource]["bag"][i]["id"]] then
- outputChatBox("attach: "..getItemName(playerItems[elementSource]["bag"][i]["id"]))
- triggerServerEvent("addAttachWeapon",localPlayer,localPlayer,playerItems[elementSource]["bag"][i]["id"],playerItems[elementSource]["bag"][i]["value"],playerItems[elementSource]["bag"][i]["dbid"])
- end
- end
- end
- end
- end
- function destroyClientAttachWeapons()
- if (playerItems[elementSource]["bag"]) then
- for i = 1, row * column do
- if (playerItems[elementSource]["bag"][i]) then
- if weaponModels[playerItems[elementSource]["bag"][i]["id"]] then
- triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,playerItems[elementSource]["bag"][i]["id"],playerItems[elementSource]["bag"][i]["value"],playerItems[elementSource]["bag"][i]["dbid"])
- end
- end
- end
- end
- end
- addEventHandler("onClientResourceStart",resourceRoot,function()
- setElementData(localPlayer,"weap:hot",0)
- setElementData(localPlayer,"handFlex",false)
- setElementData(localPlayer,"handTaser",false)
- setElementData(localPlayer,"hand:bomb",false)
- setElementData(localPlayer,"active:itemID",-1)
- setElementData(localPlayer,"active:itemSlot",-1)
- setElementData(localPlayer,"gasMaskInHead",false)
- setElementData(localPlayer,"badgeState", false)
- setElementData(localPlayer,"drugUsing",false)
- setElementData(localPlayer,"show:inv",localPlayer)
- setElementData(localPlayer,"isBriefCaseInHand",false)
- setElementData(localPlayer,"handCan",false)
- --engineImportTXD(engineLoadTXD("files/flex.txd"), 17613)
- --engineReplaceModel(engineLoadDFF("files/flex.dff", 17613), 17613)
- --engineReplaceCOL(engineLoadCOL ("files/flex.col" ), 17613)
- engineImportTXD(engineLoadTXD("files/wateringcan.txd"), 2821)
- engineReplaceModel(engineLoadDFF("files/wateringcan.dff", 2821), 2821)
- actionBarItems[localPlayer] = {}
- for i=1, actionSlots do
- --itemDBID,itemID,itemType
- actionBarItems[localPlayer][i] = {-1, -1, ""}
- end
- end)
- for i=1, actionSlots do
- bindKey(i, "down", function()
- if actionBarItems[localPlayer][i] and actionBarItems[localPlayer][i][1] > 0 and not inAmountBox and not getElementData(localPlayer, "showKillPanel") and not getElementData(localPlayer, "disabled") then
- if actionBarItems[localPlayer][i][3] ~= 'empty' then
- for b = 1, row * column do
- if (playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]) then
- if playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]["dbid"] == actionBarItems[localPlayer][i][1] then
- useItem(playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b],b)
- end
- end
- end
- end
- end
- end)
- end
- function checkActionSlot(itemDBID)
- for i = 1, actionSlots do
- if (actionBarItems[localPlayer][i]) then
- if (actionBarItems[localPlayer][i][1] == itemDBID) then
- actionBarItems[localPlayer][i] = {-1, -1, ""}
- end
- end
- end
- end
- setTimer(function()
- if getElementData(localPlayer, "loggedin") then
- pX,pY,pZ = getElementPosition(localPlayer)
- if isElement(elementSource) then
- eX,eY,eZ = getElementPosition(elementSource)
- if getDistanceBetweenPoints3D(pX,pY,pZ,eX,eY,eZ) > 3.7 then
- if showInventory then
- invMenu = 1
- activeSide = "bag"
- if getElementType(elementSource) == "vehicle" then
- setElementData(elementSource, "veh:player", nil)
- setElementData(elementSource, "veh:use", false)
- triggerServerEvent("doorState", localPlayer, elementSource, 0)
- end
- if (tostring(getElementType(elementSource))=="object") then
- if getElementModel(elementSource) == 2332 then
- setElementData(elementSource,"safe:use",false)
- setElementData(elementSource,"safe:player",nil)
- end
- end
- showInventory = false
- triggerServerEvent("getElementItems", localPlayer, localPlayer, localPlayer, 2)
- end
- end
- end
- end
- end,200,0)
- func.renderInv = function()
- hoverSlot = -1
- hoverItem = nil
- hoverCategory = 0
- if getElementData(localPlayer, "loggedin") then
- local activeItemID = getElementData(localPlayer,"active:itemID")
- local activeitemSlot = getElementData(localPlayer,"active:itemSlot")
- if(activeItemID>-1) and (activeitemSlot>-1) then
- if weaponHot >= 0.1 then
- weaponHot = weaponHot-0.3
- setElementData(localPlayer,"weap:hot",getElementData(localPlayer,"weap:hot")-0.3)
- end
- if weaponHot+randState >= 89 then
- weaponHot = 88
- setElementData(localPlayer,"weap:hot",88)
- takeStatus(getElementData(localPlayer,"active:weaponSlot"),randState)
- randState = 0
- toggleControl("fire",false)
- playSound("files/overheat.mp3")
- exports.rise_infobox:addNotificationFelsoC("A fegyvered túlmelegedett.", 2)
- end
- if weaponHot <= 18 then
- -- if not getElementData(localPlayer, "death->arm->left") and not getElementData(localPlayer, "death->arm->right") then
- --toggleControl("fire",true)
- -- end
- end
- end
- end
- --if getElementData(localPlayer,"hudVisible") then
- if getElementData(localPlayer, "loggedin") then
- if getElementData(localPlayer, "screenmode") then return end
- if showActionBar then
- --actPos = {getElementData(localPlayer, "actionbar >> posX")+8, getElementData(localPlayer, "actionbar >> posY")+8}
- --if getElementData(localPlayer, "actionbar >> enabled") then
- actPos = {sX/2-251/2, sY-56}
- dxDrawRectangle(actPos[1], actPos[2], 251, 46, tocolor(0, 0, 0, 200))
- current_action_slot = -1
- if isInBox(actPos[1]-10,actPos[2]-10,actBox[1]+20,actBox[2]+20) then
- isCursorInAction = true
- else
- isCursorInAction = false
- end
- for i=1,actionSlots do
- 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
- dxDrawRectangle(actPos[1]+5+(i-1)*41,actPos[2]+5, 36, 36, tocolor(200, 100, 0, 230))
- current_action_slot = i
- else
- --dxDrawImage(actPos[1]+(i*((itemSize+8)+2))-49,actPos[2]-4, 44, 44,"files/slot.png",0,0,0,tocolor(0,0,0,170))
- dxDrawRectangle(actPos[1]+5+(i-1)*41,actPos[2]+5, 36, 36, tocolor(44, 43, 42, 230))
- end
- if actionBarItems[localPlayer][i] and actionBarItems[localPlayer][i][3] == "empty" then
- 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))
- elseif (actionBarItems[localPlayer][i] and actionBarItems[localPlayer][i][1] > -1) then
- for b = 1, row * column do
- if (playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]) then
- if playerItems[localPlayer][getTypeOfElement(localPlayer,actionBarItems[localPlayer][i][2])[1]][b]["dbid"] == actionBarItems[localPlayer][i][1] then
- 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))
- 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"])
- end
- end
- end
- end
- --end
- end
- end
- end
- --end
- if listShow then
- dxDrawRectangle(listPos[1],listPos[2],listBox[1],listBox[2],tocolor(0,0,0,100))
- dxCreateBorder(listPos[1],listPos[2],listBox[1],listBox[2],tocolor(0,0,0,200))
- dxDrawRectangle(listPos[1]+20,listPos[2]+30,listBox[1]-40,1,tocolor(0,0,0,100))
- dxDrawText("ID",listPos[1]+58,listPos[2]+3,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- dxDrawText("Név",listPos[1]+90,listPos[2]+3,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- dxDrawText("Súly",listPos[1]+230,listPos[2]+3,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- if isInBox(listPos[1]+307,listPos[2]+5,18,18) then
- dxDrawText("",listPos[1]+307,listPos[2]+3,0,0,tocolor(210,49,49,255),1,icons,"left","top",true,true,true,true)
- else
- dxDrawText("",listPos[1]+307,listPos[2]+3,0,0,tocolor(255,255,255,255),1,icons,"left","top",true,true,true,true)
- end
- local guiText = guiGetText(searchGui)
- dxDrawRectangle(listPos[1]+10,listPos[2]+495,160,25,tocolor(0,0,0,60))
- dxDrawText(guiText,listPos[1]+13,listPos[2]+497,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- dxDrawImage(listPos[1]+176,listPos[2]+495,22,22,"files/search.png")
- if guiText == "" then
- local count = 0
- for k,v in ipairs(items) do
- if k > listWheel and count < 10 then
- count = count+1
- dxDrawImage(listPos[1]+10,listPos[2]-5+(count*45),36,36,getItemImage(tonumber(k)))
- 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)
- 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)
- 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)
- end
- end
- else
- local newText = string.lower(string.gsub(guiText, "_", " "))
- local count = 0
- for k, v in ipairs(items) do
- local name = string.lower(getItemName(k):gsub("_", " "))
- if k == tonumber(newText) or string.find(name, newText) then
- if k > searchWheel and count < 10 then
- count = count+1
- dxDrawImage(listPos[1]+10,listPos[2]-5+(count*45),36,36,getItemImage(tonumber(k)))
- 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)
- 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)
- 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)
- end
- end
- end
- if count == 0 then
- 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)
- end
- end
- end
- if not showInventory then
- return
- end
- if not isElement(elementSource) then
- return
- end
- if showNameBar then
- dxDrawRectangle(namePos[1],namePos[2],namePos[3],namePos[4],tocolor(0,0,0,120),true)
- if isInBox(namePos[1]+145,namePos[2]+4,50,namePos[4]-8) then
- dxDrawRectangle(namePos[1]+145,namePos[2]+4,50,namePos[4]-8,tocolor(172, 211, 115,200),true)
- else
- dxDrawRectangle(namePos[1]+145,namePos[2]+4,50,namePos[4]-8,tocolor(0,0,0,60),true)
- end
- dxDrawText("Mégse",namePos[1]+150,namePos[2]+4,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- if isInBox(namePos[1]+115,namePos[2]+4,25,namePos[4]-8) then
- dxDrawRectangle(namePos[1]+115,namePos[2]+4,25,namePos[4]-8,tocolor(172, 211, 115,200),true)
- else
- dxDrawRectangle(namePos[1]+115,namePos[2]+4,25,namePos[4]-8,tocolor(0,0,0,60),true)
- end
- dxDrawText("Ok",namePos[1]+118,namePos[2]+4,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- if isElement(nameGui) then
- if guiEditSetCaretIndex(nameGui, string.len(guiGetText(nameGui))) then
- guiBringToFront(nameGui)
- guiEditSetMaxLength(nameGui,15)
- end
- end
- dxDrawRectangle(namePos[1]+5,namePos[2]+4,105,namePos[4]-8,tocolor(0,0,0,60),true)
- dxDrawText(guiGetText(nameGui),namePos[1]+8,namePos[2]+4,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- end
- if isMove then
- if isCursorShowing() then
- local x, y = getCursorFuck()
- moveX,moveY = x - defX,y - defY
- end
- end
- local itemWeight = getAllItemWeight()
- inItem = false
- if (isInBox(moveX, moveY, pW+12, pH+75)) then
- inItem = true
- end
- if getElementType(elementSource) == "vehicle" or getElementType(elementSource) == "object" then
- if getElementType(elementSource) == "vehicle" then
- dxDrawImage (moveX+5,moveY+39,40,48,"files/car.png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
- elseif getElementType(elementSource) == "object" then
- dxDrawImage (moveX+5,moveY+39,40,48,"files/safe.png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
- end
- else
- for k,v in ipairs(categoryTable) do
- --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)
- if isInBox(moveX+5,moveY+39+(k-1)*69,40,48) then
- dxDrawImage (moveX+5,moveY+39+(k-1)*69,40,48,"files/"..v[1]..".png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
- if not inMove then
- hoverCategory = k
- end
- else
- if invMenu == k then
- dxDrawImage (moveX+5,moveY+39+(k-1)*69,40,48,"files/"..v[1]..".png", 0, 0, 0, tocolor(167, 166, 163 ,200),true)
- else
- dxDrawImage (moveX+5,moveY+39+(k-1)*69,40,48,"files/"..v[1]..".png", 0, 0, 0, tocolor(106,101,94,230),true)
- end
- end
- end
- end
- local drawRow = 0
- local drawColumn = 0
- if getElementType(elementSource) == "vehicle" then
- categoryText = "Jármű"
- elseif getElementType(elementSource) == "object" then
- categoryText = "Széf"
- else
- categoryText = categoryTable[invMenu][2]
- end
- --usedSlots = 0
- if activeSide == "bag" or activeSide == "key" or activeSide == "vehicle" or activeSide == "object" then
- dxDrawImage(moveX-28, moveY-40, 550, 330,"files/bg.png",0,0,0,tocolor(0,0,0,220))
- -- dxDrawRectangle(moveX, moveY, 461, 246, tocolor(0,0,0,200))
- -- dxCreateBorder2(moveX, moveY, 461, 246, tocolor(0,0,0,240))
- local skinID = getElementModel(localPlayer)
- skinID = tostring(skinID)
- if (string.len(skinID)==2) then
- skinID = "0" .. skinID
- elseif (string.len(skinID)==1) then
- skinID = "00" .. skinID
- end
- dxDrawText("#ACD373"..categoryText..":", moveX+4, moveY,0,28+moveY,tocolor(255,255,255,255),1,categoryFont,"left","center",false,false,false,true)
- local textWidth = dxGetTextWidth(categoryText, 1, categoryFont)
- local textHeight = dxGetFontHeight(1, categoryFont)
- 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)
- local amountText = table.concat(amountTable)
- if (inAmountBox) then
- if (doBlind < 60) then
- doBlind = doBlind + 1
- else
- doBlind = 0
- end
- if (doBlind <= 30) then
- amountText = table.concat(amountTable) .. "|"
- else
- amountText = table.concat(amountTable)
- end
- end
- roundedRectangle(moveX+461-53, moveY+3, 50, 20, tocolor(255,255,255,230))
- 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)
- --if selectedAmount <= 0 then
- -- selectedAmount = 1
- --guiSetText(amountBox,1)
- --end
- dxDrawText("Mennyiség:",moveX+320, moveY+2,0,0,tocolor(255,255,255,255),1,opensans,"left","top",true,true,true,true)
- --dxDrawRectangle(moveX+320+45,moveY-6-2,50,15,tocolor(0,0,0,90))
- --dxDrawRectangle(moveX+320+45,moveY-7-2,50,1,tocolor(0,0,0,160))
- --dxDrawRectangle(moveX+320+45,moveY-6-2+15,50,1,tocolor(0,0,0,160))
- --dxDrawRectangle(moveX+319+45,moveY-7-2,1,17,tocolor(0,0,0,160))
- --dxDrawRectangle(moveX+319+45+51,moveY-7-2,1,17,tocolor(0,0,0,160))
- dxDrawRectangle(moveX+53,moveY+246-13,345,10,tocolor(189, 150, 72,200))
- dxDrawRectangle(moveX+53,moveY+246-13,math.ceil(itemWeight)/getTypeOfElement(elementSource)[3]*345,10,tocolor(172, 211, 115,200))
- 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)
- --dxDrawRectangle(moveX+160-1,moveY+196+3,255,1,tocolor(0,0,0,160))
- --dxDrawRectangle(moveX+160-1,moveY+196+3+13,255,1,tocolor(0,0,0,160))
- --dxDrawRectangle(moveX+159-1,moveY+196+3,1,14,tocolor(0,0,0,160))
- --dxDrawRectangle(moveX+159-1+256,moveY+196+3,1,14,tocolor(0,0,0,160))
- usedSlots = 0
- for i = 1, row * column do
- if isInBox(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), itemSize, itemSize) then
- inSlotBox = true
- dxDrawRectangle(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, tocolor(200, 100, 0, 230))
- hoverSlot = i
- if (inventoryItems[elementSource][activeSide][i]) then
- if selectedSound ~= i then
- playSound("files/hover.mp3")
- end
- selectedSound = i
- hoverItem = (inventoryItems[elementSource][activeSide][i])
- local itemName = ""
- if #inventoryItems[elementSource][activeSide][i]["name"] <= 0 then
- itemName = getItemName(inventoryItems[elementSource][activeSide][i]["id"],tonumber(inventoryItems[elementSource][activeSide][i]["value"]))
- else
- itemName = inventoryItems[elementSource][activeSide][i]["name"]
- end
- if getElementData(localPlayer,"acc:admin") >= 8 and getElementData(localPlayer,"char:adminduty") == 1 then
- 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 %")
- else
- 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
- tooltip("#ACD373"..itemName.."#ffffff","((Azonosító: "..inventoryItems[elementSource][activeSide][i]["value"].."))")
- --elseif inventoryItems[elementSource][activeSide][i]["id"] == 85 or inventoryItems[elementSource][activeSide][i]["id"] == 86 or inventoryItems[elementSource][activeSide][i]["id"] == 87 then
- -- tooltip("#ACD373"..itemName.."#ffffff","Benne ültetve: #acd373"..items[inventoryItems[elementSource][activeSide][i]["id"]].description.."")
- --elseif inventoryItems[elementSource][activeSide][i]["id"] == 147 then
- -- tooltip("#ACD373"..itemName.."#ffffff","Befizetési határidő: #acd373"..tonumber(inventoryItems[elementSource][activeSide][i]["health"]).."#ffffff perc.")
- --elseif inventoryItems[elementSource][activeSide][i]["id"] == 148 then
- -- tooltip("#ACD373"..itemName.."#ffffff","Állapot: #acd373"..tonumber(inventoryItems[elementSource][activeSide][i]["health"]).."#ffffff %")
- --elseif inventoryItems[elementSource][activeSide][i]["id"] == 65 then
- -- tooltip("#ACD373"..itemName.."#ffffff","#ffa800"..tostring(inventoryItems[elementSource][activeSide][i]["value"]):gsub("_", " ").."#ffffff")
- elseif inventoryItems[elementSource][activeSide][i]["id"] == 205 then
- 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")
- --elseif inventoryItems[elementSource][activeSide][i]["id"] == 160 then
- -- tooltip("#ACD373"..itemName.."#ffffff","Még #acd373"..tonumber(inventoryItems[elementSource][activeSide][i]["value"]).."#ffffff szelet.")
- --elseif inventoryItems[elementSource][activeSide][i]["id"] == 190 then
- -- if tonumber(inventoryItems[elementSource][activeSide][i]["value"]) > 0 then
- -- tooltip("#ACD373"..itemName.."#ffffff","Tartalma: #acd373"..inventoryItems[elementSource][activeSide][i]["value"].."#ffffff aranyrúd")
- -- else
- -- tooltip("#ACD373"..itemName.."#ffffff")
- -- end
- elseif hotTable[weaponIndexByID[inventoryItems[elementSource][activeSide][i]["id"]]] then
- 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")
- else
- tooltip("#ACD373"..itemName.."#ffffff","Súly: #acd373"..items[inventoryItems[elementSource][activeSide][i]["id"]].weight*inventoryItems[elementSource][activeSide][i]["count"].."kg")
- end
- end
- else
- hoverItem = nil
- end
- else
- dxDrawRectangle(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, tocolor(44, 43, 42, 230))
- if inventoryItems[elementSource][activeSide][i] then
- if getTypeOfElement(elementSource,tonumber(inventoryItems[elementSource][activeSide][i]["id"]))[1] == "bag" then
- 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
- dxDrawRectangle(moveX + 94 + (drawColumn - 1) * (itemSize + margin), moveY + 28 + (drawRow*(itemSize + margin)), 36, 36, tocolor(172, 211, 115, 230))
- end
- end
- end
- inSlotBox = false
- end
- local itemData = inventoryItems[elementSource][activeSide][i]
- if (itemData) then
- local itemDbid = itemData["dbid"]
- local itemID = itemData["id"]
- local itemCount = itemData["count"]
- local itemHeath = itemData["health"]
- usedSlots = usedSlots+1
- if ((movedSlot == i)) then
- inMove = true
- local cX, cY = getCursorPosition()
- if isCursorShowing() then
- cX,cY = sX*cX,sY*cY
- else
- cX,cY = 0,0
- end
- dxDrawImage(cX - itemSize/2, cY - itemSize/2, itemSize, itemSize, getItemImage(tonumber(movedItem["id"]),movedItem["value"]), 0, 0, 0, tocolor(255, 255, 255, 255), true)
- else
- 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))
- tooltip_item(moveX + drawColumn * (itemSize + margin) + margin * 1+33, moveY + drawRow * (itemSize + margin) + margin * 1.6, itemCount)
- if items[itemID] and items[itemID].statusbar then
- 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))
- 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))
- end
- end
- end
- if (inClone) then
- local cX, cY = getCursorPosition()
- if isCursorShowing() then
- cX,cY = sX*cX,sY*cY
- else
- cX,cY = 0,0
- end
- dxDrawImage(cX - itemSize/2, cY - itemSize/2, itemSize, itemSize, getItemImage(tonumber(clonedItem["id"]),clonedItem["value"]), 0, 0, 0, tocolor(255, 255, 255, 255), true)
- end
- drawColumn = drawColumn + 1
- if (drawColumn == column) then
- drawColumn = 0
- drawRow = drawRow + 1
- end
- end
- end
- --end
- --end
- end
- addEventHandler("onClientRender", getRootElement(), func.renderInv,true,"low")
- func["invClick"] = function(pButton, pState, _, _, _, _, _, clickedElement)
- if not isTimer(addTimer) then
- if (pButton == "left" and pState == "down" and showInventory) then
- if (tonumber(hoverSlot) > -1 and hoverItem and not inClone) then
- 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
- elseif activeSide == "bag" and activeIdentity == hoverSlot then
- --elseif activeSide == "bag" and hoverItem["id"] == 206 then
- --outputChatBox("[RiseMTA]:#ffffff Ezt a tárgyat nem mozgathatod.",172, 211, 115,true)
- else
- if not showNameBar then
- startTick = getTickCount()
- movedItem = hoverItem
- movedSlot = tonumber(hoverSlot)
- playSound("files/select.mp3")
- if table.concat(amountTable) == "" then
- nilMoving = true
- else
- inClone = true
- clonedItem = hoverItem
- clonedSlot = tonumber(hoverSlot)
- end
- end
- end
- end
- if isInBox(moveX+461-53, moveY+3, 50, 20) then
- inAmountBox = true
- else
- inAmountBox = false
- end
- if activeSide == "bag" or activeSide == "key" then
- if(isCursorInAction and current_action_slot > -1) then
- actionBarItems[elementSource][current_action_slot] = {-1, -1, ""}
- triggerServerEvent("deleteActionBarItem",localPlayer,localPlayer,current_action_slot)
- end
- end
- elseif (pButton == "left" and pState == "up" and showInventory) then
- if activeSide == "bag" or activeSide == "key" then
- if (not inItem and isCursorInAction and movedItem and movedSlot > -1) then
- if actionBarItems[elementSource][current_action_slot][1] == -1 then
- actionBarItems[elementSource][current_action_slot] = {movedItem["dbid"], movedItem["id"], activeSide}
- triggerServerEvent("moveItemToActionBar",localPlayer,localPlayer,movedItem["dbid"], movedItem["id"], activeSide,current_action_slot)
- end
- end
- if (not inItem and not isCursorInAction and movedItem and movedSlot > -1) then
- if clickedElement and getElementType(clickedElement) == "object" and (getElementModel(clickedElement) ~= 1359 and getElementModel(clickedElement) ~= 2332) then
- local screenx, screeny, worlditemX, worlditemY, worlditemZ = getCursorPosition()
- local tx, ty, tz = getWorldFromScreenPosition ( sX*screenx, sY*screeny, 50 )
- local px, py, pz = getCameraMatrix()
- hit, gx,gy,gz, elementHit = processLineOfSight ( px, py, pz, tx, ty, tz )
- if getDistanceBetweenPoints3D(gx,gy,gz, getElementPosition(localPlayer)) < 3 then
- if getItemDropable(movedItem["id"]) then
- if movedItem["duty"] == 1 then
- outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
- else
- triggerServerEvent("dropItem",localPlayer,localPlayer,gx,gy,gz,movedItem["id"],movedItem["value"],movedItem["count"],movedItem["health"],movedItem["name"])
- if weaponModels[movedItem["id"]] then
- triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,movedItem["id"],movedItem["value"],movedItem["dbid"])
- end
- triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, movedItem)
- inventoryItems[elementSource][activeSide][movedSlot] = nil
- end
- else
- outputChatBox("[RiseMTA]:#ffffff Ez a tárgy nem eldobható.",172, 211, 115,true)
- end
- end
- end
- end
- end
- if hoverSlot == movedSlot then
- hideClone()
- end
- if not hoverItem then
- if hoverSlot == -1 then
- hideClone()
- end
- end
- if hoverItem and movedItem then
- if hoverItem["id"] == movedItem["id"] then
- if not items[hoverItem["id"]].stackable then
- if selectedAmount >= 1 then
- hideClone()
- end
- end
- elseif hoverItem["id"] ~= movedItem["id"] then
- if selectedAmount >= 1 then
- hideClone()
- end
- end
- end
- if (movedSlot > -1 and movedItem and not hoverItem and hoverSlot > -1 and hoverSlot ~= movedSlot and inItem and inMove) then
- if table.concat(amountTable) == "" then
- setItemSlot(movedSlot, hoverSlot)
- delItemSlot(movedSlot)
- else
- if movedItem["count"] >= selectedAmount then
- if movedItem["count"] - selectedAmount == 0 then
- delItem(movedSlot,1)
- else
- setItemCount(movedSlot, movedItem["count"] - selectedAmount)
- end
- createNewItem(hoverSlot, movedItem["dbid"], movedItem["id"], movedItem["value"], selectedAmount, movedItem["duty"],movedItem["health"],movedItem["name"],movedItem["weaponserial"])
- end
- hideClone()
- end
- playSound("files/move.mp3")
- 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
- if table.concat(amountTable) == "" then
- setItemCount(hoverSlot, hoverItem["count"] + movedItem["count"])
- delItem(movedSlot)
- else
- if hoverItem["id"] == clonedItem["id"] then
- if clonedItem["count"] >= selectedAmount then
- setItemCount(movedSlot, movedItem["count"] - selectedAmount)
- setItemCount(hoverSlot, hoverItem["count"] + selectedAmount)
- if clonedItem["count"] == 0 then
- delItem(clonedSlot)
- end
- end
- hideClone()
- end
- end
- 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
- if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
- if not (isVehicleLocked(clickedElement)) then
- if movedItem["duty"] == 1 then
- outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
- else
- if movedItem["id"] ~= 93 then
- updateClick = updateClick+1
- triggerServerEvent("tradeItem", localPlayer, localPlayer, clickedElement, elementSource, movedItem,updateClick)
- else
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott tárgyat, csak egy másik játékosnak tudod átadni.",172, 211, 115,true)
- end
- end
- else
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott jármű zárva van.",172, 211, 115,true)
- end
- end
- 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
- if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
- if movedItem["duty"] == 1 then
- outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
- else
- if getElementType(elementSource) ~= "vehicle" and getElementType(elementSource) ~= "object" then
- updateClick = updateClick+1
- triggerServerEvent("tradeItem", localPlayer, localPlayer, clickedElement, elementSource, movedItem,updateClick)
- else
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott inventoryból, csak magadra tudod húzni ezt a tárgyat.",172, 211, 115,true)
- end
- end
- end
- 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
- if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
- local itemName = ""
- if #movedItem["name"] <= 0 then
- itemName = getItemName(movedItem["id"],tonumber(movedItem["value"]))
- else
- itemName = movedItem["name"]
- end
- exports["rise_chat"]:sendLocalMeMessage(localPlayer,"kidob egy tárgyat a szemetesbe. ("..itemName..")")
- if weaponModels[movedItem["id"]] then
- triggerServerEvent("delAttachWeapon",localPlayer,localPlayer,movedItem["id"],movedItem["value"],movedItem["dbid"])
- end
- triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, movedItem)
- inventoryItems[elementSource][activeSide][movedSlot] = nil
- end
- 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
- if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
- updateClick = updateClick+1
- triggerServerEvent("tradeItem", localPlayer, localPlayer, localPlayer, elementSource, movedItem,updateClick)
- end
- 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
- if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
- updateClick = updateClick+1
- triggerServerEvent("tradeItem", localPlayer, localPlayer, localPlayer, elementSource, movedItem,updateClick)
- end
- 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
- if getDistanceFromElement(elementSource, clickedElement) < 3.5 then
- if movedItem["duty"] == 1 then
- outputChatBox("[RiseMTA]:#ffffff Szolgálati tárggyal nem végezhető el ez a funkció.",172, 211, 115,true)
- else
- if movedItem["id"] ~= 93 then
- if hasItem(153, getElementData(clickedElement, "dbid")) then
- updateClick = updateClick+1
- triggerServerEvent("tradeItem", localPlayer, localPlayer, clickedElement, elementSource, movedItem,updateClick)
- else
- outputChatBox("[RiseMTA]:#ffffff Nincs kulcsod ehhez a széfhez.",172, 211, 115,true)
- end
- else
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott tárgyat, csak egy másik játékosnak tudod átadni.",172, 211, 115,true)
- end
- end
- end
- end
- hideMove()
- elseif (pButton == "right" and pState == "down" and showInventory and not inMove and movedSlot < 0) then
- if hoverSlot >=1 then
- if hoverItem then
- if elementSource == localPlayer then
- if getKeyState("lctrl") then
- if hasItem(175) then
- if hoverItem["id"] ~= 175 then
- if not getItemStackable(hoverItem["id"]) then
- if not showNameBar then
- showNameBar = true
- showNameSlot = hoverSlot
- local curX, curY = getCursorFuck()
- namePos[1],namePos[2] = curX, curY
- if not isElement(nameGui) then
- nameGui = guiCreateEdit (-1000,-1000,0,0,"",false)
- guiSetAlpha(nameGui,0)
- end
- end
- else
- outputChatBox("[RiseMTA]:#ffffff Csak olyan tárgyat nevezhetsz át amit nem lehet stack-elni.",172, 211, 115,true)
- end
- else
- outputChatBox("[RiseMTA]:#ffffff Névtáblát nem nevezhetsz át.",1,122,188,true)
- end
- end
- else
- useItem(hoverItem,hoverSlot)
- end
- end
- end
- end
- elseif (pButton == "right" and pState == "up" and showInventory) then
- end
- if (pButton == "right" and pState == "down") then
- if (clickedElement and getElementType(clickedElement) == "vehicle" and (tonumber(getElementData(clickedElement, "veh:id") or 0) > 0 or getElementData(clickedElement, 'rentboat:id'))) then -- Kocsi
- if getDistanceFromElement(localPlayer, clickedElement) < 3.5 then
- if showInventory then
- if isInBox(moveX-4,moveY-16,pW+12,pH+64) then
- return
- end
- end
- if isPedInVehicle(localPlayer) then return end
- if not getElementData(localPlayer,"mechanicing") then
- if (isVehicleLocked(clickedElement)) then
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott jármű csomagtartója zárva van.",172, 211, 115,true)
- else
- if getElementData(clickedElement,"veh:use") then
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott jármű csomagtartója használatban van.",172, 211, 115,true)
- else
- showInventory = true
- invMenu = 1
- activeSide = "vehicle"
- elementSource = clickedElement
- setElementData(clickedElement, "veh:player", localPlayer)
- setElementData(clickedElement, "veh:use", true)
- triggerServerEvent("getElementItems", localPlayer, localPlayer, clickedElement, 2)
- if not isElement(amountBox) then
- amountBox = guiCreateEdit (-1000,-1000,0,0,"",false)
- guiSetAlpha(amountBox,0)
- end
- setElementData(localPlayer,"show:inv",clickedElement)
- triggerServerEvent("doorState", localPlayer, clickedElement, 1)
- exports["rise_chat"]:sendLocalMeMessage(localPlayer,"belenézett egy jármű csomagtartójába.")
- end
- end
- end
- end
- end
- if (clickedElement and getElementType(clickedElement) == "object" and tonumber(getElementData(clickedElement, "dbid") or 0) > 0) then -- Széf
- if getDistanceFromElement(localPlayer, clickedElement) < 3.5 then
- if showInventory then
- if isInBox(moveX-4,moveY-16,pW+12,pH+64) then
- return
- end
- end
- if getElementData(clickedElement,"szef") then
- if hasItem(153,getElementData(clickedElement, "dbid")) then
- if getElementData(clickedElement,"safe:use") then
- outputChatBox("[RiseMTA]:#ffffff A kiválasztott széf használatban van.",172, 211, 115,true)
- else
- showInventory = true
- invMenu = 1
- activeSide = "object"
- elementSource = clickedElement
- triggerServerEvent("getElementItems", localPlayer, localPlayer, clickedElement, 2)
- if not isElement(amountBox) then
- amountBox = guiCreateEdit (-1000,-1000,0,0,"",false)
- guiSetAlpha(amountBox,0)
- end
- setElementData(localPlayer,"show:inv",clickedElement)
- setElementData(clickedElement,"safe:use",true)
- setElementData(clickedElement,"safe:player",localPlayer)
- exports["rise_chat"]:sendLocalMeMessage(localPlayer,"belenézett egy széfbe.")
- end
- else
- if activeSide ~= "object" then
- outputChatBox("[RiseMTA]:#ffffff Nincs kulcsod ehhez a széfhez.",172, 211, 115,true)
- end
- end
- end
- end
- end
- end
- end
- end
- addEventHandler("onClientClick", getRootElement(),func["invClick"])
- function removeDecimal(number)
- local num = number
- local num2 = tostring(num)
- local found = nil
- for i=1,100000 do
- if string.sub(num2,i,i) == "." then
- found = i
- end
- end
- if type(found) == "number" then
- num2 = string.sub(num2,1,found-1)
- end
- num = tonumber(num2)
- return num
- end
- addEventHandler("onClientGUIChanged", getRootElement(),function()
- if source == amountBox then
- local currentAmount = guiGetText (source)
- if string.len(currentAmount) > 0 then
- local am = tonumber(currentAmount)
- if am then
- selectedAmount = removeDecimal(am)
- else
- guiSetText(source, currentAmount)
- end
- else
- --guiSetText(source, 0)
- --selectedAmount = 0
- end
- end
- end)
- function outputPressedCharacter(character)
- if showInventory and inAmountBox and #amountTable < 3 then
- 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
- amountTable[#amountTable + 1] = character
- selectedAmount = removeDecimal(table.concat(amountTable))
- end
- end
- end
- addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter)
- addEventHandler("onClientKey", getRootElement(),
- function(k, v)
- if not (v) then
- return
- end
- if (showInventory) then
- if (k == "backspace") then
- table.remove(amountTable, #amountTable)
- end
- end
- end
- )
- function createNewItem(newSlot, itemDBID, itemID, itemValue, itemCount, itemDuty, itemHealth,itemName,weaponSerial)
- if (newSlot > -1 and itemDBID and itemID and itemValue and itemCount and itemDuty and itemHealth) then
- triggerServerEvent("createNewItem", localPlayer, localPlayer, elementSource, itemID, newSlot,itemCount,itemDuty,itemValue,itemHealth,itemName,weaponSerial,itemDBID)
- end
- end
- function setItemCount(itemSlot, newCount)
- if (itemSlot > -1 and newCount > -1) then
- if activeSide == "craft" then
- newMenu = "bag"
- else
- newMenu = activeSide
- end
- triggerServerEvent("updateItemCount", localPlayer, localPlayer, elementSource, itemSlot, newCount,inventoryItems[elementSource][newMenu][itemSlot])
- inventoryItems[elementSource][newMenu][itemSlot]["count"] = newCount
- if (elementSource == localPlayer) then
- playerItems[elementSource][newMenu][itemSlot]["count"] = newCount
- end
- end
- end
- function setItemName(itemSlot, newName)
- if (itemSlot > -1 and newName) then
- if activeSide == "craft" then
- newMenu = "bag"
- else
- newMenu = activeSide
- end
- triggerServerEvent("updateItemName", localPlayer, localPlayer, elementSource, itemSlot, newName, inventoryItems[elementSource][newMenu][itemSlot])
- inventoryItems[elementSource][newMenu][itemSlot]["name"] = newName
- if (elementSource == localPlayer) then
- playerItems[elementSource][newMenu][itemSlot]["name"] = newName
- end
- end
- end
- function setItemValue(itemSlot, newCount)
- if (itemSlot > -1 and newCount > -1) then
- if activeSide == "craft" then
- newMenu = "bag"
- else
- newMenu = activeSide
- end
- triggerServerEvent("updateItemValue", localPlayer, localPlayer, elementSource, itemSlot, newCount, inventoryItems[elementSource][newMenu][itemSlot])
- inventoryItems[elementSource][newMenu][itemSlot]["value"] = newCount
- if (elementSource == localPlayer) then
- playerItems[elementSource][newMenu][itemSlot]["value"] = newCount
- end
- end
- end
- function delItemSlot(itemSlot)
- if (itemSlot > -1) then
- inventoryItems[elementSource][activeSide][itemSlot] = nil
- if (elementSource == localPlayer) then
- playerItems[elementSource][activeSide][itemSlot] = nil
- end
- end
- end
- function getAllItemWeight()
- local bagWeight = 0
- local keyWeight = 0
- local vehWeight = 0
- local objectWeight = 0
- if isElement(elementSource) then
- if getElementType(elementSource) == "player" then
- if inventoryItems[elementSource]["bag"] then
- for i = 1, row * column do
- if (inventoryItems[elementSource]["bag"][i]) then
- bagWeight = bagWeight + (getItemWeight(inventoryItems[elementSource]["bag"][i]["id"]) * inventoryItems[elementSource]["bag"][i]["count"])
- end
- end
- end
- if inventoryItems[elementSource]["key"] then
- for i = 1, row * column do
- if (inventoryItems[elementSource]["key"][i]) then
- keyWeight = keyWeight + (getItemWeight(inventoryItems[elementSource]["key"][i]["id"]) * inventoryItems[elementSource]["key"][i]["count"])
- end
- end
- end
- end
- if getElementType(elementSource) == "vehicle" then
- if inventoryItems[elementSource] then
- if inventoryItems[elementSource]["vehicle"] then
- for i = 1, row * column do
- if (inventoryItems[elementSource]["vehicle"][i]) then
- vehWeight = vehWeight + (getItemWeight(inventoryItems[elementSource]["vehicle"][i]["id"]) * inventoryItems[elementSource]["vehicle"][i]["count"])
- end
- end
- end
- end
- end
- if getElementType(elementSource) == "object" then
- if inventoryItems[elementSource]["object"] then
- for i = 1, row * column do
- if (inventoryItems[elementSource]["object"][i]) then
- objectWeight = objectWeight + (getItemWeight(inventoryItems[elementSource]["object"][i]["id"]) * inventoryItems[elementSource]["object"][i]["count"])
- end
- end
- end
- end
- end
- return bagWeight + keyWeight + vehWeight + objectWeight
- end
- function delItem(itemSlot,state)
- if not state then
- state = 0
- end
- if (itemSlot > -1) then
- if activeSide == "craft" then
- newMenu = "bag"
- else
- newMenu = activeSide
- end
- if state == 0 then
- if getElementType(elementSource) == "player" then
- for i=1, actionSlots do
- if actionBarItems[elementSource][i] then
- if actionBarItems[elementSource][i][1] == inventoryItems[elementSource][newMenu][itemSlot]["dbid"] then
- triggerServerEvent("deleteActionBarItem",localPlayer,localPlayer,i)
- actionBarItems[elementSource][i][1] = {-1,-1,""}
- end
- end
- end
- end
- end
- triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, inventoryItems[elementSource][newMenu][itemSlot],state)
- inventoryItems[elementSource][newMenu][itemSlot] = nil
- if (elementSource == localPlayer) then
- playerItems[elementSource][newMenu][itemSlot] = nil
- end
- end
- end
- function takeStatus(itemSlot, statusMinus)
- itemSlot = tonumber(itemSlot)
- if (itemSlot > -1) then
- if tonumber(inventoryItems[elementSource]["bag"][itemSlot]["health"]) - tonumber(statusMinus) <= 0 then
- triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, inventoryItems[elementSource][activeSide][itemSlot])
- inventoryItems[elementSource][activeSide][itemSlot] = nil
- if (elementSource == localPlayer) then
- playerItems[elementSource][activeSide][itemSlot] = nil
- end
- local activeItemID = getElementData(localPlayer,"active:itemID")
- local activeitemSlot = getElementData(localPlayer,"active:itemSlot")
- local activeWeapSlot = getElementData(localPlayer,"active:weaponSlot")
- if(activeItemID>-1) and (activeitemSlot>-1) then
- if activeWeaponSlot == itemSlot then
- activeWeaponSlot = -1
- activeAmmoSlot = - 1
- setElementData(localPlayer,"active:weaponSlot",-1)
- setElementData(localPlayer,"active:itemID",-1)
- setElementData(localPlayer,"active:itemSlot",-1)
- triggerServerEvent("elveszfegyot",localPlayer,localPlayer)
- end
- end
- return
- else
- triggerServerEvent("takeStatus", localPlayer, localPlayer, elementSource, inventoryItems[elementSource]["bag"][itemSlot], tonumber(inventoryItems[elementSource]["bag"][itemSlot]["health"]) - statusMinus)
- inventoryItems[elementSource]["bag"][itemSlot]["health"] = tonumber(inventoryItems[elementSource]["bag"][itemSlot]["health"]) - statusMinus
- return
- end
- end
- end
- function takeItem(item)
- local elem = 0
- if activeSide == "craft" then
- thisMenu = "bag"
- else
- thisMenu = activeSide
- end
- for i = 1, row * column do
- if (inventoryItems[elementSource][thisMenu][i]) then
- if item == inventoryItems[elementSource][thisMenu][i]["id"] then
- elem = elem+1
- if elem == 1 then
- if inventoryItems[elementSource][thisMenu][i]["count"] > 1 then
- setItemCount(i,inventoryItems[elementSource][thisMenu][i]["count"]-1)
- else
- delItem(i)
- end
- end
- end
- end
- end
- end
- addEvent("takeItemServer",true)
- addEventHandler("takeItemServer",getRootElement(),takeItem)
- function setItemSlot(oldSlot, newSlot)
- if (oldSlot > -1 and newSlot > -1) then
- inventoryItems[elementSource][activeSide][newSlot] = inventoryItems[elementSource][activeSide][oldSlot]
- if (elementSource == localPlayer) then
- playerItems[elementSource][activeSide][newSlot] = inventoryItems[elementSource][activeSide][oldSlot]
- end
- updateClick = updateClick+1
- triggerServerEvent("updateItemSlot", localPlayer, localPlayer, elementSource, newSlot, inventoryItems[elementSource][activeSide][oldSlot],oldSlot,updateClick)
- end
- end
- function hideMove()
- startTick = -1
- movedItem = nil
- movedSlot = -1
- inMove = false
- end
- function hideClone()
- clonedItem = nil
- clonedSlot = -1
- inClone = false
- end
- function hasActionItem(actionItem)
- hasTheItem = false
- if (actionItem) then
- if (playerItems[elementSource]["bag"] and playerItems[elementSource]["key"]) then
- for i = 1, row * column do
- if (playerItems[elementSource]["bag"][i]) then
- if (actionItem["dbid"] == playerItems[elementSource]["bag"][i]["dbid"]) then
- hasTheItem = true
- end
- end
- end
- for i = 1, row * column do
- if (playerItems[elementSource]["key"][i]) then
- if (actionItem["dbid"] == playerItems[elementSource]["key"][i]["dbid"]) then
- hasTheItem = true
- end
- end
- end
- if hasTheItem then
- return true
- else
- return false
- end
- return false
- end
- return false
- end
- return false
- end
- function giveItem(itemID, itemValue, itemCount, itemDuty)
- triggerServerEvent("giveItem", localPlayer, localPlayer, itemID, itemValue, itemCount, itemDuty)
- end
- function hasItem(itemID, itemValue)
- if (not itemValue) then
- if (playerItems[elementSource]["bag"] and playerItems[elementSource]["key"] and getElementType(elementSource) == "player") then
- for i = 1, row * column do
- if (playerItems[elementSource]["bag"][i]) then
- if (itemID == playerItems[elementSource]["bag"][i]["id"]) then
- return true, itemID, itemValue, i, "bag", countItemsInInventory(itemID),playerItems[elementSource]["bag"][i]["count"]
- end
- end
- end
- for i = 1, row * column do
- if (playerItems[elementSource]["key"][i]) then
- if (itemID == playerItems[elementSource]["key"][i]["id"]) then
- return true, itemID, itemValue, i, "key"
- end
- end
- end
- return false
- end
- return false
- else
- if (playerItems[elementSource]["bag"] and playerItems[elementSource]["key"] and getElementType(elementSource) == "player") then
- for i = 1, row * column do
- if (playerItems[elementSource]["bag"][i]) then
- if (itemID == playerItems[elementSource]["bag"][i]["id"] and tonumber(itemValue) == tonumber(playerItems[elementSource]["bag"][i]["value"])) then
- return true, itemID, tonumber(itemValue), i
- end
- end
- end
- for i = 1, row * column do
- if (playerItems[elementSource]["key"][i]) then
- if (itemID == playerItems[elementSource]["key"][i]["id"] and tonumber(itemValue) == tonumber(playerItems[elementSource]["key"][i]["value"])) then
- return true, itemID, tonumber(itemValue), i
- end
- end
- end
- return false
- end
- return false
- end
- return false
- end
- --[[setTimer(function()
- if (playerItems[elementSource]["licens"]) then
- for i = 1, row * column do
- if (playerItems[elementSource]["licens"][i]) then
- if (playerItems[elementSource]["licens"][i]["id"] ==147) then
- if (i > -1) then
- if tonumber(inventoryItems[elementSource]["licens"][i]["health"]) - 1 <= 0 then
- triggerServerEvent("takeTicket",localPlayer,localPlayer,tonumber(inventoryItems[elementSource]["licens"][i]["value"]))
- triggerServerEvent("deleteItem", localPlayer, localPlayer, elementSource, inventoryItems[elementSource]["licens"][i])
- inventoryItems[elementSource]["licens"][i] = nil
- if (elementSource == localPlayer) then
- playerItems[elementSource]["licens"][i] = nil
- end
- else
- triggerServerEvent("takeStatus", localPlayer, localPlayer, localPlayer, inventoryItems[elementSource]["licens"][i], tonumber(inventoryItems[elementSource]["licens"][i]["health"]) - 1)
- inventoryItems[elementSource]["licens"][i]["health"] = tonumber(inventoryItems[elementSource]["licens"][i]["health"]) - 1
- if inventoryItems[elementSource]["licens"][i]["health"] == 5 then
- outputChatBox("[RiseMTA]:#ffffff Hamarosan le fog járni a befizetési határidőd. (#3d7abc5#ffffff perc)",172, 211, 115,true)
- end
- end
- end
- end
- end
- end
- end
- end,60000,0)--]]
- function countItemsInInventory(itemID, count)
- if (playerItems[elementSource]["bag"]) then
- local count = 0
- for i = 1, row * column do
- if (playerItems[elementSource]["bag"][i]) then
- if (itemID == playerItems[elementSource]["bag"][i]["id"]) then
- count = count + 1
- end
- end
- end
- return count
- end
- return false
- end
- function hasItemOnSlot(slot)
- if (playerItems[elementSource]["bag"][slot] and tonumber(playerItems[elementSource]["bag"][slot]["id"] or -1) > -1) then
- return true
- end
- return false
- end
- function isInBox(xS,yS,wS,hS)
- if(isCursorShowing()) then
- local cursorX, cursorY = getCursorPosition()
- cursorX, cursorY = cursorX*sX, cursorY*sY
- if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then
- return true
- else
- return false
- end
- end
- end
- function getDistanceFromElement(from, to)
- if not from or not to then return end
- local x, y, z = getElementPosition(from)
- local x1, y1, z1 = getElementPosition(to)
- return getDistanceBetweenPoints3D(x, y, z, x1, y1, z1)
- end
- addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(),function(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
- local activeItemID = getElementData(localPlayer,"active:itemID")
- local activeitemSlot = getElementData(localPlayer,"active:itemSlot")
- if(activeItemID>-1) and (activeitemSlot>-1) then
- local witem = tonumber(getElementData(localPlayer,"active:itemID"))
- local wslot = tonumber(getElementData(localPlayer,"active:itemSlot"))
- if (items[witem].isWeapon) then
- if(tonumber(playerItems[localPlayer]["bag"][wslot]["count"] or -1)<=1)then
- activeWeaponSlot = -1
- activeAmmoSlot = - 1
- delItem(wslot)
- setElementData(localPlayer,"active:itemID",-1)
- setElementData(localPlayer,"active:itemSlot",-1)
- else
- setItemCount(wslot,playerItems[localPlayer]["bag"][wslot]["count"]-1)
- end
- if hotTable[getPedWeapon(localPlayer)] then
- randState = math.random(1,7)
- weaponHot = weaponHot+hotTable[getPedWeapon(localPlayer)]
- setElementData(localPlayer,"weap:hot",getElementData(localPlayer,"weap:hot")+hotTable[getPedWeapon(localPlayer)])
- end
- end
- end
- end)
- addEvent("activeWeapon",true)
- addEventHandler("activeWeapon",getRootElement(),function(slot)
- activeWeaponSlot = slot
- end)
- function deleteActiveIdentitySlot()
- if activeIdentity >= 1 then
- delItem(activeIdentity)
- activeIdentity = -1
- end
- end
- function deleteActiveIdentity()
- if activeIdentity >= 1 then
- activeIdentity = -1
- end
- end
- function deleteActiveBomb()
- triggerServerEvent("deleteItem", localPlayer,localPlayer,localPlayer,inventoryItems[localPlayer]["bag"][activeBomb])
- activeBomb = -1
- triggerServerEvent("takeBomb",localPlayer,localPlayer)
- setElementData(localPlayer,"hand:bomb",false)
- end
- if not xmlLoadFile("inventory.xml") then
- local posF = xmlCreateFile("inventory.xml", "root")
- local mainC = xmlCreateChild(posF, "actPos")
- local mainC2 = xmlCreateChild(posF, "invPos")
- xmlNodeSetValue(xmlCreateChild(mainC, "x"), actPos[1])
- xmlNodeSetValue(xmlCreateChild(mainC, "y"), actPos[2])
- xmlNodeSetValue(xmlCreateChild(mainC, "slots"),actionSlots)
- xmlNodeSetValue(xmlCreateChild(mainC2, "x"), moveX)
- xmlNodeSetValue(xmlCreateChild(mainC2, "y"), moveY)
- xmlSaveFile(posF)
- --outputChatBox("Mivel neked nem volt xml file-od ahova menthetné most le kreáltam neked egyet.")
- else
- local posF = xmlLoadFile("inventory.xml")
- local mainC = xmlFindChild(posF, "actPos", 0)
- local mainC2 = xmlFindChild(posF, "invPos", 0)
- setElementData(localPlayer, "act:x", tonumber(xmlNodeGetValue(xmlFindChild(mainC, "x", 0))))
- setElementData(localPlayer, "act:y", tonumber(xmlNodeGetValue(xmlFindChild(mainC, "y", 0))))
- setElementData(localPlayer, "act:slot", tonumber(xmlNodeGetValue(xmlFindChild(mainC, "slots", 0))))
- setElementData(localPlayer, "inv:x", tonumber(xmlNodeGetValue(xmlFindChild(mainC2, "x", 0))))
- setElementData(localPlayer, "inv:y", tonumber(xmlNodeGetValue(xmlFindChild(mainC2, "y", 0))))
- actPos[1] = getElementData(localPlayer, "act:x")
- actPos[2] = getElementData(localPlayer, "act:y")
- actionSlots = getElementData(localPlayer, "act:slot")
- if actionSlots >= 7 then
- plusSlot = ((actionSlots-6)*46)
- end
- moveX = getElementData(localPlayer, "inv:x")
- moveY = getElementData(localPlayer, "inv:y")
- end
- function savePos()
- local posF = xmlLoadFile("inventory.xml")
- if posF then
- local mainC = xmlFindChild(posF, "actPos", 0)
- xmlNodeSetValue(xmlFindChild(mainC, "x", 0), actPos[1])
- xmlNodeSetValue(xmlFindChild(mainC, "y", 0), actPos[2])
- xmlNodeSetValue(xmlFindChild(mainC, "slots", 0), actionSlots)
- local mainC2 = xmlFindChild(posF, "invPos", 0)
- xmlNodeSetValue(xmlFindChild(mainC2, "x", 0), moveX)
- xmlNodeSetValue(xmlFindChild(mainC2, "y", 0), moveY)
- xmlSaveFile(posF)
- end
- end
- addEventHandler("onClientResourceStop", getResourceRootElement(getThisResource()), savePos)
- addEventHandler("onClientPlayerQuit", getRootElement(), savePos)
- function roundedRectangle(x, y, w, h, borderColor, bgColor, loginPostGUI)
- if (x and y and w and h) then
- if (not borderColor) then
- borderColor = tocolor(0, 0, 0, 255);
- end
- if (not bgColor) then
- bgColor = borderColor;
- end
- dxDrawRectangle(x, y, w, h, bgColor, loginPostGUI);
- dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, loginPostGUI);
- dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, loginPostGUI);
- dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, loginPostGUI);
- dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, loginPostGUI);
- end
- end
- function dxCreateBorder2(x,y,w,h,color)
- dxDrawRectangle(x-2,y-2,w+4,2,color) -- Fent
- dxDrawRectangle(x-2,y,2,h,color) -- Bal Oldal
- dxDrawRectangle(x-2,y+h,w+4,2,color) -- Lent Oldal
- dxDrawRectangle(x+w,y-2,2,h+2,color) -- Jobb Oldal
- end
- function dxCreateBorder(x,y,w,h,color)
- dxDrawRectangle(x,y-1,w,1,color)
- dxDrawRectangle(x,y+h,w,1,color)
- dxDrawRectangle(x-1,y-1,1,h+2,color)
- dxDrawRectangle(x+w,y-1,1,h+2,color)
- end
- addEvent("updateItemClick",true)
- addEventHandler("updateItemClick",getRootElement(),function()
- updateClick = 0
- end)
- _triggerServerEvent = triggerServerEvent
- _network = 1
- _networkS = 1
- addEventHandler('onClientPlayerNetworkStatus', root, function(s)
- _networkS = s
- end)
- addEventHandler('onClientRender', root, function()
- if getPlayerPing(localPlayer) < 200 then
- _network = 1
- else
- _network = 0
- end
- end)
- 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)
- if a == 'tradeItem' then
- if _network == 1 and _networkS == 1 then
- _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)
- else
- outputChatBox('#DC143C[RiseMTA]:#FFFFFF Hálózati hiba miatt a művelet nem hajtható végre.', 0, 0, 0, true)
- end
- else
- _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)
- end
- end
Add Comment
Please, Sign In to add comment