Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fileExists("client.lua") then
- fileDelete("client.lua")
- end
- local monitorSize = {guiGetScreenSize()}
- local show = false
- local Elsolepes = false
- local create = false
- local createEdit = false
- local cursorinInventory = false
- local item_table_player = {}
- local item_table_action = {}
- local itemElement = nil
- local item_size = 40
- local sor, oszlop, margin = 0, 0, 0
- local font = dxCreateFont("files/fonts/myriadproregular.ttf",9) --<[ Font ]>--
- local font2 = dxCreateFont("files/fonts/myriadproregular.ttf",10) --<[ Font ]>--
- local Tick = getTickCount()
- local actionbarSlot = 6
- local tooltip_text_color = tocolor(255, 255, 255, 255)
- local clickedSlot = -1
- local movedSlot = -1
- local cloneSlot = -1
- local clickedItem = -1
- local movedItem = -1
- local cloneItem = -1
- local clickedCount = -1
- local movedCount = -1
- local cloneCount = -1
- local clickedValue = -1
- local movedValue = -1
- local cloneValue = -1
- local clickDown = nil
- local currentSlot = -1
- local cursorIsActionbar = false
- local moving = true
- local currentItem = 0
- local currentCount = 0
- local weight = 0
- local currentValue = 0
- local countText = ""
- local clientActionSlot = 0
- local statisztikaSzazaleka = 0
- local hasznaloSlot = -1
- local hasznaloItem = -1
- local hasznaloCount = -1
- local hasznaloValue = -1
- local showAction = true
- local moveOffsetX, moveOffsetY = 0, 0
- local weaponTable = {
- [14] = true,
- [15] = true,
- [16] = true,
- [17] = true,
- [18] = true,
- [22] = true,
- [23] = true,
- [24] = true,
- [25] = true,
- }
- local jugadores = {}
- local lplayer = getLocalPlayer()
- local info = {}
- local sx,sy = guiGetScreenSize()
- local slotok = {}
- local playerWeaponTable = {}
- local lplayer = getLocalPlayer()
- local info = {}
- local sx,sy = guiGetScreenSize()
- local weaponsTable = {14,15,16,17,18,20,22,23,24}
- for i=1, actionbarSlot do
- item_table_action[i] = {-1, -1, -1}
- end
- for i = 0 , 50 do
- setElementData(localPlayer, "char:fishing"..i, false)
- setElementData(localPlayer, "char:weaponGettin"..i, false)
- setElementData(localPlayer, "char:badge"..i, false)
- end
- for _, value in ipairs (getElementsByType("vehicle")) do
- setElementData(value, "inUse", false)
- setElementData(value, "clickToVehicle", 0)
- end
- setElementData(localPlayer, "char:vehicle", false)
- function getItemImg(item)
- return fileExists("files/items/"..item..".png") and "files/items/"..item..".png" or "files/items/0.png"
- end
- function receiveItems(data)
- item_table = {}
- item_table = data
- if(itemElement and getElementType(itemElement) == "player" and itemElement == localPlayer or itemElement==nil )then
- item_table_player = data
- for index, value in ipairs (item_table) do
- if value[5] > 0 then
- item_table_action[tonumber(value[5])] = {item_table[tonumber(index)][6], item_table[tonumber(index)][1], item_table[tonumber(index)][3]}
- end
- end
- end
- isMove = false
- movedItem = 0
- newCount = 0
- movedSlot = -1
- movedCount = 0
- movedValue = 0
- selectedAmount = 0
- currentActionSlot = 0
- end
- addEvent("onClientReceiveItems", true)
- addEventHandler("onClientReceiveItems", getRootElement(), receiveItems)
- addEventHandler("onClientElementDataChange", getRootElement(), function(dataName)
- if source and getElementType(source) == "player" and source == localPlayer and dataName == "loggedin" then
- setTimer(function()
- triggerServerEvent("playerLoadItemsToServer", localPlayer, localPlayer)
- --streamedIn()
- end, 1000, 1)
- end
- end)
- function isInSlot(xS,yS,wS,hS)
- if(isCursorShowing()) then
- XY = {guiGetScreenSize()}
- local cursorX, cursorY = getCursorPosition()
- cursorX, cursorY = cursorX*XY[1], cursorY*XY[2]
- if(dobozbaVan(xS,yS,wS,hS, cursorX, cursorY)) then
- return true
- else
- return false
- end
- end
- end
- function dobozbaVan(dX, dY, dSZ, dM, eX, eY)
- if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then
- return true
- else
- return false
- end
- end
- function checkCursor()
- if not guiGetInputEnabled() and not isMTAWindowActive() and isCursorShowing( ) then
- return true
- else
- return false
- end
- end
- function getCursorPos()
- if checkCursor() then
- cx,cy = getCursorPosition ()
- cx,cy = cx*panelX,cy*panelY
- else
- cx,cy = -500,-500
- end
- return cx,cy
- end
- function isInBox( xmin, ymin, xmax, ymax )
- if checkCursor() then
- x,y = getCursorPos()
- xmin = tonumber(xmin) or 0
- xmax = (tonumber(xmax) or 0)+xmin
- ymin = tonumber(ymin) or 0
- ymax = (tonumber(ymax) or 0)+ymin
- return x >= xmin and x <= xmax and y >= ymin and y <= ymax
- else
- return false
- end
- end
- function dxDrawRectangleBox(left, top, width, height)
- --dxDrawRectangle(left, top, width, height, tocolor(71, 167, 223,50))
- dxDrawRectangle(left-1, top, 1, height, tocolor(71, 167, 223,230))
- dxDrawRectangle(left+width, top, 1, height, tocolor(71, 167, 223,230))
- dxDrawRectangle(left, top-1, width, 1, tocolor(71, 167, 223,230))
- dxDrawRectangle(left, top+height, width, 1, tocolor(71, 167, 223,230))
- end
- function getSlot(slot)
- slot = slot + 1
- if not item_table then
- item_table = {}
- end
- if(item_table[slot] and item_table[slot][1])then
- return item_table[slot][1]
- else
- return -1
- end
- end
- function getItemCountNormal()
- local c = 0
- local item = 50
- for i=1, item do
- if(item_table[element][i][1]>-1)then
- c = c + 1
- end
- end
- k = c
- return k
- end
- function getSlotCount(slot)
- slot = slot + 1
- if item_table[slot] then
- if(item_table[slot][3])then
- return item_table[slot][3]
- else
- return 1
- end
- end
- end
- function math.round(number, decimals, method)
- decimals = decimals or 0
- local factor = 10 ^ decimals
- if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
- else return tonumber(("%."..decimals.."f"):format(number)) end
- end
- function getSlotValue(slot)
- slot = slot + 1
- if item_table[slot] then
- if (item_table[slot][2])then
- return item_table[slot][2]
- else
- return 0
- end
- end
- end
- addEventHandler("onClientClick", root, function(key, state, cx, cy)
- if show then
- if key == "left" and state == "down" then
- if cx >= panelX and cx <= panelX+width then
- if cy >= panelY and cy <= panelY+25 then
- moveOffset = true
- moveOffsetX, moveOffsetY = cx-panelX, cy-panelY
- end
- end
- else
- moveOffset = false
- end
- end
- end)
- function setSlotValue(slot, item, val, db, duty)
- slot = slot + 1
- if (not item) then item = 0 end
- if (not val) then val = 0 end
- if (not db) then db = 1 end
- item_table[slot] = {item, val, db, -1, -1, slot, duty}
- triggerServerEvent("updateValue", itemElement, itemElement, slot, item, val, db, duty)
- end
- function hasItem(element, itemID, itemValue)
- if element == localPlayer then
- if itemValue then
- for k,v in pairs(item_table) do
- if v[1] == itemID and tonumber(v[2]) == tonumber(itemValue) then
- return true, k, v[2], v[3]
- end
- end
- else
- for k,v in pairs(item_table) do
- if v[1] == itemID then
- return true, k, v[2], v[3]
- end
- end
- end
- end
- return false
- end
- function getPlayeritems(element)
- if element then
- return item_table
- end
- end
- function deleteItem(element, slot)
- if not element and not slot then return end
- triggerServerEvent("deleteSlot", element, element, slot)
- end
- function getPlayerItem(itemID)
- if not itemID then return end
- for k,v in pairs(item_table) do
- if v[1] == itemID then
- modositItemCountIfWant(v[6])
- break
- end
- end
- end
- function openInventory(element)
- itemElement = element
- if not (create and item_table) then
- create = true
- --triggerServerEvent("sendPlayerItemsToClient", getLocalPlayer(), getLocalPlayer(), getLocalPlayer())
- triggerServerEvent("triggerItemsByType", localPlayer, itemElement)
- end
- end
- for i=1, actionbarSlot do
- bindKey(i, "down", function()
- if isTimer(timer) then return end
- timer = setTimer(function() end, 2000, 1) --- spam védelem
- if item_table_action[i] and item_table_action[i][2] > -1 and hasItem(localPlayer, item_table_action[i][2]) then
- useItem(item_table[item_table_action[i][1]][4], item_table[item_table_action[i][1]][6], item_table[item_table_action[i][1]][1], item_table[item_table_action[i][1]][2], item_table[item_table_action[i][1]][3])
- end
- if item_table_action[i] and item_table_action[i][1] and item_table[item_table_action[i][1]][3] < 1 and hasItem(localPlayer, item_table_action[i][2]) then
- item_table_action[i] = {-1, -1, -1}
- end
- end)
- end
- function split(text, delimeter)
- local result = {}
- for match in (text..delimeter):gmatch("(.-)"..delimeter) do
- result[#result + 1] = match
- end
- return result
- end
- function getItemsWeight()
- local weight = 0
- if(item_table)then
- for i=1, 50 do
- if(item_table[i] and item_table[i][1]>0)then
- weight = weight + getItemWeight(item_table[i][1])*item_table[i][3]
- end
- end
- end
- return weight
- end
- function getMaxWeight()
- if(tostring(getElementType(itemElement))=="player")then
- return 25
- elseif(tostring(getElementType(itemElement))=="vehicle")then
- return 50
- elseif(tostring(getElementType(itemElement))=="object")then
- return 100
- end
- return 0
- end
- addCommandHandler("seeinv", function(cmd, name)
- if getElementData(localPlayer,"acc:admin") <= 1 then
- return
- end
- if(not name)then
- outputChatBox("#47a7df[Használat]: #ffffff/"..cmd.." [Név]",0,0,0,true)
- return
- end
- local targetPlayer, targetPlayerName = exports.mta_main:findPlayer(getLocalPlayer(), name)
- if(not targetPlayer)then
- return
- end
- openInventory(targetPlayer)
- show = true
- Elsolepes = true
- Tick = getTickCount()
- progress = "OutBack"
- showAction = false
- toggleControl ("fire", false)
- playSound("files/sounds/open.mp3", false)
- moving = false
- end)
- function checkPlayerInventory(Player)
- openInventory(Player)
- show = true
- Elsolepes = true
- Tick = getTickCount()
- progress = "OutBack"
- showAction = false
- toggleControl ("fire", false)
- playSound("files/sounds/open.mp3", false)
- moving = false
- end
- function createInventory()
- ------ActionBar
- if not getElementData(localPlayer, "loggedin") then return end
- if not getElementData(localPlayer, "toggle-->All") then return end
- if isPedDead(localPlayer) then return end
- monitorSize = {guiGetScreenSize()}
- if showAction then
- clientActionSlot = -1
- local width, height = item_size*actionbarSlot + 5*(actionbarSlot+1)
- dxDrawRectangle(monitorSize[1]/2-width/2, monitorSize[2]-60+5-5, width, item_size+10, tocolor(0, 0, 0, 200))
- if (isInSlot(monitorSize[1]/2-width/2, monitorSize[2]-60+5-5, width, item_size+10)) then
- cursorIsActionbar = true
- else
- cursorIsActionbar = false
- end
- for i= 1, actionbarSlot do
- dxDrawRectangle(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5, monitorSize[2]-60+5, item_size, item_size, tocolor(255, 255, 255, 20))
- if getKeyState(i) then
- dxDrawRectangle(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5+2, monitorSize[2]-60+5+2, item_size-4, item_size-4, tocolor(71, 167, 223, 100))
- end
- if isInSlot(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5, monitorSize[2]-60+5, item_size, item_size) then
- dxDrawRectangle(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5, monitorSize[2]-60+5, item_size, item_size, tocolor(71, 167, 223, 100))
- clientActionSlot = i
- end
- if(item_table_action[i] and item_table_action[i][1]>-1 and hasItem(localPlayer, item_table_action[i][2]))then
- dxDrawImage(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5, monitorSize[2]-60+5, item_size, item_size, getItemImg(item_table_action[i][2]), 0, 0, 0, tocolor(255,255,255,255), false) --Item
- if item_table[item_table_action[i][1]] and item_table[item_table_action[i][1]][3] > 1 then
- dxDrawText(item_table[item_table_action[i][1]][3], monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-2, monitorSize[2]-60+5+item_size-15+1, item_size, item_size, tocolor(0, 0, 0, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawText(item_table[item_table_action[i][1]][3], monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-1, monitorSize[2]-60+5+item_size-15, item_size, item_size, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- end
- if isInSlot(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5, monitorSize[2]-60+5, item_size, item_size, item_size, item_size) or getKeyState(i) then
- dxDrawRectangleBox(monitorSize[1]/2-width/2 + 5 + item_size*(i-1) + 5*i-5, monitorSize[2]-60+5, item_size, item_size)
- end
- end
- end
- end
- --------------------------------------------------------------------------
- -------------------------- Inventory ---------------------------------------
- sor, oszlop, margin = 5, 10, 5 -- 2 * 5 = 10 Slot
- width, height = item_size*oszlop + margin*(oszlop+1), item_size * sor + (1+sor)*margin
- clickedSlot = -1
- clickedItem = -1
- if create then
- if Elsolepes then
- local Time = (getTickCount() - Tick) / 1000
- if Time < 1 then
- panelY = interpolateBetween(-width,0,0,monitorSize[2]/2-height/2,0,0,Time,progress)
- if moveOffsetX == 0 then
- panelX = monitorSize[1]-width - 55
- else
- --panelX = panelX
- panelX = monitorSize[1]-width - 55
- end
- end
- elseif not Elsolepes then
- if panelY ~= 0-width then
- local Time = (getTickCount() - Tick) / 1000
- panelY = interpolateBetween(panelY,0,0,-width,0,0,Time,progress)
- panelX = monitorSize[1]-width - 55
- else
- show = false
- create = false
- toggleControl ("fire", true)
- end
- end
- local name = "Ismeretlen"
- if(getElementType(itemElement)=="player")then
- name = "Inventory"
- elseif(getElementType(itemElement)=="vehicle")then
- name = "Csomagtartó"
- elseif(getElementType(itemElement)=="object")then
- name = "Széf"
- end
- if(isInSlot(panelX, panelY, width+20, height+60))then
- cursorinInventory = true
- else
- cursorinInventory = false
- end
- if isCursorShowing() and moveOffset then
- local cx, cy = getCursorPosition()
- local cx, cy = cx*monitorSize[1], cy*monitorSize[2]
- panelX = cx-moveOffsetX
- panelY = cy-moveOffsetY
- end
- dxDrawRectangle(panelX, panelY, width+20, height+40, tocolor(0, 0, 0, 200)) -- Bg
- dxDrawRectangle(panelX, panelY, width+20, 25, tocolor(0, 0, 0, 230))-- Felirat hattere
- dxDrawRectangle(panelX, panelY+25, width+20, 3, tocolor(71, 167, 223, 230))--Zöld vonal
- dxDrawText("Northen Life MTA - #47a7df"..name, panelX+5, panelY+5, width+10, 3, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawText("Mennyiség: ", panelX+5+width-135, panelY+4, width+10, 3, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- if isElement(btn_edit) then
- countText = guiGetText(btn_edit)
- if countText == "" then
- countText = ""
- end
- if tonumber(countText) then
- dxDrawText(countText, panelX+width-63, panelY+5, 80, 15, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- else
- dxDrawText("Csak számot", panelX+width-63, panelY+5, 80, 15, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- end
- end
- dxDrawRectangle(panelX+width-65, panelY+5, 80, 15, tocolor(255, 255, 255, 80))-- mennyiség hattere
- dxDrawImage(panelX+(width-200)/2, panelY+height/2, 200, 50, "files/images/logo.png", 0, 0, 0, tocolor(255, 255, 255, 80)) ---<[ LOGO ]>---
- local j_old = 0
- local itembg = 0
- local i = 0
- local isMove = false
- local weight = getItemsWeight()
- local weights = 0
- for szam=0, (oszlop*sor)-1 do
- local j = math.floor(szam/oszlop)
- if(j~=j_old)then
- i = 0
- end
- --if item_table[szam + 1] then
- local item = getSlot(szam)
- local value = getSlotValue(szam)
- local count = getSlotCount(szam)
- dxDrawRectangle(panelX+10 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size, item_size, item_size, tocolor(255, 255, 255, 20)) -- Item BG
- if(item>-1) and (show)then
- weights = weights +1
- isMove = clickDown and movedItem and ( getTickCount( ) - clickDown >= 130 )
- if(not(isMove and movedItem==item and movedSlot==szam)) and item_table[szam + 1] then
- dxDrawImage(panelX+10 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size, item_size, item_size, getItemImg(item), 0, 0, 0, tocolor(255,255,255, 255)) --Item IMG
- if count > 1 then
- dxDrawText(count, panelX+12 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size+item_size-16 , item_size, item_size, tocolor(0, 0, 0, 255), 1, font, "left", "top", false, false, false, true)
- dxDrawText(count, panelX+13 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size+item_size-15 , item_size, item_size, tocolor(255, 255, 255, 255), 1, font, "left", "top", false, false, false, true)
- end
- end
- end
- if isInSlot(panelX+10 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size, item_size, item_size) then
- clickedSlot = szam
- clickedItem = item
- clickedCount = count
- clickedValue = value
- if (item == -1) then
- dxDrawRectangle(panelX+10 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size, item_size, item_size, tocolor(71, 167, 223,170)) -- Item BG Hover
- elseif (item >= -1) then
- dxDrawRectangleBox(panelX+10 + i*item_size + (i+1)*margin, panelY+29 + (j+1)*margin + j*item_size, item_size, item_size)
- tooltip_items(getItemName(item, value))
- end
- end
- i = i + 1
- j_old = j
- --end
- end
- dxDrawRectangle(panelX+width+margin*2+12, panelY+28, 26, height+12, tocolor(0, 0, 0, 170))-- súly hattere
- dxDrawRectangle(panelX+width+margin*2+13, panelY+29+height+10, 24, (-height-10)*weight/getMaxWeight(), tocolor(71, 167, 223, 230))-- súly
- --dxDrawText("Súly: "..math.floor(weights).."/50", panelX+7+(width)/2+1, panelY+height+30+2+20/2+1, panelX+7+(width)/2+1, panelY+height+30+2+20/2+1, tocolor(0, 0, 0, 255), 1, font2, "center", "center", false, false, false, true)
- -- dxDrawText("Súly: "..math.floor(weights).."/50", panelX+7+(width)/2, panelY+height+30+2+20/2, panelX+7+(width)/2, panelY+height+30+2+20/2, tocolor(255, 255, 255, 255), 1, font2, "center", "center", false, false, false, true)
- if(isMove and movedItem>-1 and movedSlot>-1 ) and (show) then
- local x,y = getCursorPosition( )
- local x,y = x * monitorSize[1]-item_size/2, y * monitorSize[2]-item_size/2
- dxDrawImage(x,y, item_size, item_size, getItemImg(movedItem), 0, 0, 0, tocolor(255,255,255, 255)) --Item Move
- dxDrawRectangleBox(x,y, item_size, item_size)
- end
- if(isMove and cloneItem>-1 and cloneSlot>-1 and cloneCount>1 ) and (show)then
- dxDrawImage(cx - item_size/2, cy - item_size/2, item_size, item_size, getItemImg(cloneItem), 0, 0, 0, tocolor(255,255,255, 255)) --Item Move
- tooltip_items(getItemName(item, value))
- end
- end
- end
- addEventHandler("onClientRender", root ,createInventory)
- bindKey("i", "down", function ()
- if not getElementData(localPlayer, "loggedin") or false then return end
- if isPedDead(localPlayer) then
- outputChatBox("#D24D57[Northen Life MTA]: #ffffff Halottan nem tudod megnyitni az inventory-t.",255, 255, 255, true)
- return
- end
- --if isTimer(timer) then outputChatBox("anyádat flúdold te cigány kurva") return end
- --timer = setTimer(function() end, 3000, 1) --- spam védelem
- showCursor(not show)
- if not show then
- show = true
- setElementData(localPlayer, "char:vehicle", false)
- Elsolepes = true
- Tick = getTickCount()
- openInventory(localPlayer)
- progress = "OutBack"
- showAction = true
- toggleControl ("fire", false)
- moving = true
- moveOffset = false
- --moveOffsetX, moveOffsetY = 0, 0
- playSound("files/sounds/open.mp3", false)
- else
- Tick = getTickCount()
- Elsolepes = false
- showAction = true
- setElementData(itemElement, "inUse", false)
- createEdit = true
- cursorinInventory = false
- progress = "OutBack"
- toggleControl ("fire", true)
- createEditFunction("remove")
- countText = ""
- isMove = false
- movedItem = 0
- newCount = 0
- statisztikaSzazaleka = 0
- movedSlot = -1
- movedCount = 0
- movedValue = 0
- selectedAmount = 0
- if getElementType(itemElement)=="vehicle" then
- triggerServerEvent("doorState", itemElement, itemElement, 0)
- setElementData(itemElement, "clickToVehicle", 0)
- setElementData(itemElement, "inUse", false)
- setElementData(localPlayer, "char:vehicle", false)
- end
- hasznaloSlot = -1
- hasznaloItem = -1
- hasznaloCount = -1
- hasznaloValue = -1
- playSound("files/sounds/close.mp3", false)
- end
- end)
- addEventHandler( "onPlayerNetworkStatus", root,
- function( status, ticks )
- if status == 0 then
- outputDebugString( "(packets from " .. getPlayerName(source) .. ") interruption began " .. ticks .. " ticks ago" )
- elseif status == 1 then
- outputDebugString( "(packets from " .. getPlayerName(source) .. ") interruption began " .. ticks .. " ticks ago and has just ended" )
- end
- end
- )
- function packetLossCheck()
- local loss = getNetworkStats()["messagesInSendBuffer"]
- if (loss > 0) then
- moving = false
- destroyItemMove()
- else
- --moving = true
- end
- end
- setTimer(packetLossCheck, 1000, 0) -- Ezt kell most kuhúzni de akkor majd lehet bugoltatni tesó.
- local rovid = "#D24D57[Northen Life MTA]:#FFFFFF"
- local clickNumber = 0
- addEventHandler("onClientClick", getRootElement(), function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
- if (getPlayerPing(localPlayer) > 220) then return outputChatBox("#47a7df[Item figyelő] #ff0000FIGYELEM! #ffffffNagy ping érzékelve! Amíg nem kezdesz valamit a pingeddel az összes #3399ffitem műveletet#ffffff letiltottuk!", 255, 255, 255, true) end
- packetLossCheck()
- if(button=="right" and state=="down")then
- if(not cursorinInventory and not create and isElement(clickedElement) and tostring(getElementType(clickedElement))~=false)then
- if(getElementType(clickedElement)=="vehicle" and (getElementData(clickedElement, "veh:id") or -1)>0)then
- local x,y,z = getElementPosition(getLocalPlayer())
- local x2,y2,z2 = getElementPosition(clickedElement)
- if getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ) < 5 then
- if not getElementData(clickedElement, "inUse") or tonumber(getElementData(clickedElement, "clickToVehicle") or 0) ~= 0 then
- if not isPedInVehicle(localPlayer) then
- if not isVehicleLocked(clickedElement) then
- triggerServerEvent("checkVehicleInvenroty", localPlayer, localPlayer, clickedElement)
- else
- outputChatBox("#22A7F0[Northen Life MTA] #ffffffA jármű csomagtartója zárva#ffffff van!", 255, 255, 255, true)
- end
- else
- outputChatBox("#22A7F0[Northen Life MTA] #ffffffKocsiban nem nyithatod meg az inventory#ffffff-t.", 255, 255, 255, true)
- end
- else
- outputChatBox("#D24D57[Northen Life MTA] #ffffffMár használatban van a kiválasztott inventory!", 255, 255, 255, true)
- end
- end
- elseif(getElementType(clickedElement)=="object" and getElementModel(clickedElement) == 2332) then
- if hasItem(localPlayer, 37, getElementData(clickedElement, "safe->ID")) or (getElementData(localPlayer, "acc:admin") or 0) > 7 then
- show = true
- Elsolepes = true
- Tick = getTickCount()
- openInventory(clickedElement)
- progress = "OutBack"
- showAction = true
- toggleControl ("fire", false)
- setElementData(localPlayer, "char:vehicle", true)
- moving = true
- moveOffset = false
- exports['mta_chat']:sendLocalMeMessage(localPlayer ,"belenéz egy széfbe.")
- else
- outputChatBox("#4183D7[Northen Life MTA] #ffffffSajnálom de nincs kulcsod a széfhez.", 255, 255, 255, true)
- end
- end
- end
- if(clickedItem>-1) and (show) then
- hasznaloSlot = clickedSlot + 1
- hasznaloItem = clickedItem
- hasznaloCount = clickedCount
- hasznaloValue = clickedValue
- end
- elseif(button=="right" and state=="up") and (show) and (cursorinInventory) and moving and movedItem < 1 then
- if itemElement == localPlayer then
- if isTimer(timer) then return end
- timer = setTimer(function() end, 2000, 1) --- spam védelem
- useItem(item_table[hasznaloSlot][4], hasznaloSlot,hasznaloItem, hasznaloValue, hasznaloCount)
- end
- hasznaloSlot = -1
- hasznaloItem = -1
- hasznaloCount = -1
- hasznaloValue = -1
- elseif(button=="left" and state=="down" and moving)then
- if(clickedItem>-1) and (show) and (clickedItem ~= 59) and (clickedItem ~= 60) and (clickedItem ~= 61) and (clickedItem ~= 62) and (clickedItem ~= 139) then
- movedSlot = clickedSlot
- movedItem = clickedItem
- movedValue = clickedValue
- movedCount = clickedCount
- clickDown = getTickCount( )
- end
- if(cursorIsActionbar and clientActionSlot>-1) and moving then
- triggerServerEvent("deleteActionBar", localPlayer, localPlayer, item_table_action[clientActionSlot][1])
- item_table_action[clientActionSlot] = {-1, -1, -1}
- end
- sor, oszlop, margin = 5, 10, 5 -- 2 * 5 = 10 Slot
- width, height = item_size*oszlop + margin*(oszlop+1), item_size * sor + (1+sor)*margin
- if moving and show and dobozbaVan (panelX+width-65, panelY+5, 80, 15, absoluteX, absoluteY) then
- createEditFunction("create")
- if guiEditSetCaretIndex(btn_edit, string.len(guiGetText(btn_edit))) then
- guiBringToFront(btn_edit)
- end
- end
- if(clickedItem>-1) and (show) then
- hasznaloSlot = clickedSlot + 1
- hasznaloItem = clickedItem
- hasznaloCount = clickedCount
- hasznaloValue = clickedValue
- end
- elseif(button=="right" and state=="up") and (show) and (cursorinInventory) and moving and movedItem < 1 then
- if itemElement == localPlayer then
- if isTimer(timer) then return end
- timer = setTimer(function() end, 2000, 1) --- spam védelem
- useItem(item_table[hasznaloSlot][4], hasznaloSlot,hasznaloItem, hasznaloValue, hasznaloCount)
- end
- hasznaloSlot = -1
- hasznaloItem = -1
- hasznaloCount = -1
- hasznaloValue = -1
- elseif(button=="left" and state=="down" and moving)then
- if(clickedItem>-1) and (show) then
- movedSlot = clickedSlot
- movedItem = clickedItem
- movedValue = clickedValue
- movedCount = clickedCount
- clickDown = getTickCount( )
- end
- if(cursorIsActionbar and clientActionSlot>-1) and moving then
- triggerServerEvent("deleteActionBar", localPlayer, localPlayer, item_table_action[clientActionSlot][1])
- item_table_action[clientActionSlot] = {-1, -1, -1}
- end
- sor, oszlop, margin = 5, 10, 5 -- 2 * 5 = 10 Slot
- width, height = item_size*oszlop + margin*(oszlop+1), item_size * sor + (1+sor)*margin
- if moving and show and dobozbaVan (panelX+width-65, panelY+5, 80, 15, absoluteX, absoluteY) then
- createEditFunction("create")
- if guiEditSetCaretIndex(btn_edit, string.len(guiGetText(btn_edit))) then
- guiBringToFront(btn_edit)
- end
- end
- elseif(button=="left" and state=="up") then
- currentSlot = clickedSlot
- currentActionSlot = clientActionSlot
- currentItem = clickedItem
- currentValue = clickedValue
- currentCount = clickedCount
- clickDown = getTickCount( )
- if(not cursorinInventory and cursorIsActionbar and movedItem >-1 and movedSlot>-1)then
- if itemElement == localPlayer then
- for k=1, actionbarSlot do
- if item_table_action[k][1] == movedSlot+1 or getElementData(localPlayer, "char:fishing"..movedSlot+1) or getElementData(localPlayer, "char:badge"..movedSlot+1)or getElementData(localPlayer, "char:weaponGettin"..movedSlot+1) then
- destroyItemMove()
- outputChatBox("#D24D57[Northen Life MTA]: #ffffffCsak akkor tudod húzni a tárgyat ha az nincs az actionbar-on vagy nincs használatban!",255,255,255,true)
- return
- end
- end
- item_table_action[currentActionSlot] = {movedSlot+1, movedItem, movedCount}
- triggerServerEvent("saveActionBar", localPlayer, localPlayer, currentActionSlot, movedItem, movedValue, movedCount, movedSlot)
- end
- elseif((activeWeaponSlot == -1) and( cursorinInventory) and movedSlot>-1 and movedItem>0 and currentItem<0 and currentItem~=movedItem and currentSlot~=movedSlot and currentSlot > -1 and selectedAmount < 1 and moving )then
- for k=1, actionbarSlot do
- if item_table_action[k][1] == movedSlot+1 or getElementData(localPlayer, "char:fishing"..movedSlot+1) or getElementData(localPlayer, "char:badge"..movedSlot+1)or getElementData(localPlayer, "char:weaponGettin"..movedSlot+1) then
- destroyItemMove()
- outputChatBox("#D24D57[Northen Life MTA]: #ffffffCsak akkor tudod húzni a tárgyat ha az nincs az actionbar-on vagy nincs használatban!",255,255,255,true)
- return
- end
- end
- setSlot(currentSlot, movedItem, movedValue, movedCount, item_table[movedSlot+1][7] or -1)
- delSlot(movedSlot)
- playSound("files/sounds/mozgat.mp3", false)
- elseif((activeWeaponSlot == -1) and(cursorinInventory) and movedSlot>-1 and movedItem>0 and currentSlot~=movedSlot and currentSlot > -1 and selectedAmount < movedCount and selectedAmount > 0 and currentItem~=movedItem and items[movedItem][4] and moving and item_table[movedSlot+1][7] ~= 1 )then
- newCount = movedCount - selectedAmount
- setSlotCount(movedSlot, newCount, item_table[movedSlot+1][7] or -1)
- setSlot(currentSlot, movedItem, movedValue, selectedAmount, item_table[movedSlot+1][7] or -1)
- setSlotValue(movedSlot, movedItem, movedValue, newCount, item_table[movedSlot+1][7] or -1)
- createEditFunction("remove")
- playSound("files/sounds/mozgat.mp3", false)
- elseif((activeWeaponSlot == -1) and(cursorinInventory) and movedSlot>-1 and currentSlot~=movedSlot and movedItem>0 and currentSlot > -1 and currentItem==movedItem and items[movedItem][4] and item_table[movedSlot+1][7] == item_table[currentSlot+1][7] and moving )then
- createEditFunction("remove")
- newCounts = currentCount + movedCount
- setSlotCount(currentSlot, newCounts, item_table[movedSlot+1][7] or -1)
- setSlotValue(currentSlot, movedItem, movedValue, newCounts, item_table[movedSlot+1][7] or -1)
- delSlot(movedSlot)
- playSound("files/sounds/mozgat.mp3", false)
- elseif((activeWeaponSlot == -1) and movedSlot>-1 and movedItem>0 and clickedElement~=itemElement and isElement(clickedElement) and tostring(getElementType( clickedElement))~="false" and not cursorinInventory and moving ) then
- if(getElementType(clickedElement)=="player" or getElementType(clickedElement)=="vehicle" or getElementType(clickedElement)=="object")then
- local x,y,z = getElementPosition(itemElement)
- local x2,y2,z2 = getElementPosition(clickedElement)
- if getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ) < 5 then
- if item_table[movedSlot+1] and tonumber(item_table[movedSlot+1][7]) == 1 then
- outputChatBox("#D24D57[Northen Life MTA] #ffffffDuty itemet nem tudsz áttadni.", 255, 255, 255, true)
- elseif item_table[movedSlot+1] and tonumber(item_table[movedSlot+1][7]) or -1 ~= 1 then
- for k=1, actionbarSlot do
- if item_table_action[k][1] == movedSlot+1 or getElementData(localPlayer, "char:fishing"..movedSlot+1) or getElementData(localPlayer, "char:badge"..movedSlot+1)or getElementData(localPlayer, "char:weaponGettin"..movedSlot+1) then
- destroyItemMove()
- outputChatBox("#D24D57[Northen Life MTA]: #ffffff Csak akkor tudod húzni a tárgyat ha az nincs az actionbar-on vagy nincs használatban!",255,255,255,true)
- return
- end
- end
- if getElementType(clickedElement)=="vehicle" then
- if not (isVehicleLocked(clickedElement)) then
- Elsolepes = false
- Tick = getTickCount()
- progress = "OutBack"
- setElementData(clickedElement, "clickToVehicle", 0)
- setElementData(localPlayer, "char:vehicle", false)
- end
- else
- Elsolepes = false
- Tick = getTickCount()
- progress = "OutBack"
- setElementData(itemElement, "clickToVehicle", 0)
- setElementData(localPlayer, "char:vehicle", false)
- end
- if getElementType(clickedElement)=="vehicle" and (getElementData(clickedElement, "veh:id") or -1)>0 and getElementType(clickedElement)~="Bike" and getElementType(clickedElement)~="BMX" then
- if not (isVehicleLocked(clickedElement)) then
- if getElementData(clickedElement, "inUse") or tonumber(getElementData(clickedElement, "clickToVehicle") or 0) ~= 0 then
- outputChatBox(rovid.." Addig nem tudsz belerakni tárgyat a csomagtartóba amíg azt valaki használja.", 255, 255, 255, true)
- return
- end
- exports['mta_chat']:sendLocalMeMessage(localPlayer ,"berak egy tárgyat a jármű csomagtartójába. (".. getItemName(movedItem) ..")")
- triggerServerEvent("moveItemToPlayer", itemElement, itemElement, clickedElement, movedSlot, movedItem, movedValue, movedCount)
- triggerServerEvent("MoveItemToAnimation", itemElement, itemElement, clickedElement)
- else
- outputChatBox("#D24D57[Northen Life MTA]: #ffffff A jármű csomagtartója zárva van!",255,255,255,true)
- end
- elseif getElementType(clickedElement)=="player" and getElementType(itemElement)=="player" and not getElementData(clickedElement, "char:vehicle" ) then
- exports['mta_chat']:sendLocalMeMessage(localPlayer, "átad egy tárgyat ".. getPlayerName(clickedElement):gsub("_"," ").."-nak/nek (".. getItemName(movedItem)..")")
- triggerServerEvent("moveItemToPlayer", itemElement, itemElement, clickedElement, movedSlot, movedItem, movedValue, movedCount)
- triggerServerEvent("MoveItemToAnimation", itemElement, itemElement, clickedElement)
- elseif getElementType(itemElement)=="vehicle" and getElementType(clickedElement)=="player" and clickedElement == localPlayer then
- exports['mta_chat']:sendLocalMeMessage(localPlayer, "kivesz egy tárgyat a jármű csomagtartójából. (".. getItemName(movedItem) ..")")
- setElementData(itemElement, "inUse", false)
- setElementData(itemElement, "clickToVehicle", 0)
- show = false
- triggerServerEvent("moveItemToPlayer", itemElement, itemElement, clickedElement, movedSlot, movedItem, movedValue, movedCount)
- triggerServerEvent("moveItemToText", itemElement, itemElement, clickedElement, movedSlot, movedItem, movedValue, movedCount)
- triggerServerEvent("MoveItemToAnimation", itemElement, itemElement, clickedElement)
- if getElementType(itemElement)=="vehicle" then
- triggerServerEvent("doorState", itemElement, itemElement, 0)
- showAction = true
- end
- elseif getElementType(clickedElement) =="object" and getElementModel(clickedElement) == 2332 and moving then
- if hasItem(localPlayer, 37, getElementData(clickedElement, "safe->ID")) then
- if movedItem ~= 37 and movedValue ~= getElementData(clickedElement, "safe->ID") then
- exports['mta_chat']:sendLocalMeMessage(localPlayer ,"berak egy tárgyat a széfbe. (".. getItemName(movedItem) ..")")
- triggerServerEvent("moveItemToPlayer", itemElement, itemElement, clickedElement, movedSlot, movedItem, movedValue, movedCount)
- triggerServerEvent("MoveItemToAnimation", itemElement, itemElement, clickedElement)
- else
- outputChatBox("#D24D57[Northen Life MTA] #ffffffSzéfkulcsot nem tehetsz a széfbe.", 255, 255, 255, true)
- end
- end
- elseif getElementType(itemElement) =="object" and getElementModel(itemElement) == 2332 and getElementType(clickedElement)=="player" and clickedElement == localPlayer then
- exports['mta_chat']:sendLocalMeMessage(localPlayer ,"kivett egy tárgyat a széfbe. (".. getItemName(movedItem) ..")")
- triggerServerEvent("moveItemToPlayer", itemElement, itemElement, clickedElement, movedSlot, movedItem, movedValue, movedCount)
- triggerServerEvent("MoveItemToAnimation", itemElement, itemElement, clickedElement)
- elseif(getElementType(clickedElement)=="object" and getElementModel(clickedElement)==1359 and moving ) then
- local x,y,z = getElementPosition(itemElement)
- local x2,y2,z2 = getElementPosition(clickedElement)
- if getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ) < 5 then
- delSlot(movedSlot)
- exports['mta_chat']:sendLocalMeMessage(localPlayer ,"kidobott egy tárgyat a kukába. ("..getItemName(movedItem)..")")
- if items[movedItem][5] or -1 > 0 then
- triggerServerEvent("weapons->BackToRoot", localPlayer, localPlayer)
- end
- end
- end
- end
- end
- end
- end
- destroyItemMove()
- end
- end)
- function destroyItemMove()
- isMove = false
- movedItem = 0
- newCount = 0
- movedSlot = -1
- movedCount = 0
- movedValue = 0
- selectedAmount = 0
- currentActionSlot = 0
- end
- function checkVehicleInvenrotyClient(player, element)
- local returnold = false
- for i = 1, 50 do
- if getElementData(localPlayer, "char:fishing"..i) or getElementData(localPlayer, "char:weaponGettin"..i) or getElementData(localPlayer, "char:badge"..i) then
- returnold = true
- break
- end
- end
- if returnold then
- outputChatBox(rovid.." Addig nem tudod megnyitni a csomagtartót még nem rakod el a fegyvert!", 255, 255, 255, true)
- setElementData(element, "clickToVehicle", getElementData(element, "clickToVehicle") - 1)
- return
- end
- if getElementData(element, "inUse") then
- outputChatBox(rovid.." Addig nem tudod megnyitni a csomagtartót míg valaki más is megnyitotta!", 255, 255, 255, true)
- return
- end
- setElementData(element, "inUse", true)
- show = true
- create = false
- showAction = false
- item_table = {}
- Elsolepes = true
- statisztikaSzazaleka = 0
- Tick = getTickCount()
- progress = "OutBack"
- openInventory(element)
- triggerServerEvent("triggerItemsByType", localPlayer, element)
- setElementData(localPlayer, "char:vehicle", true)
- exports['mta_chat']:sendLocalMeMessage(localPlayer ,"belenézett egy " ..exports.exg_carshop:getVehicleRealName(getElementModel(element)).. " csomagtartójába.")
- triggerServerEvent("doorState", element, element, 1)
- end
- addEvent("checkVehicleInvenrotyClient", true)
- addEventHandler("checkVehicleInvenrotyClient", root, checkVehicleInvenrotyClient)
- function createEditFunction(type)
- if type == "create" then
- if isElement(btn_edit) then destroyElement(btn_edit) end
- btn_edit = guiCreateEdit (-10000, -10000, 100, 20, "", false )
- guiEditSetMaxLength(btn_edit, 5)
- else
- if isElement(btn_edit) then destroyElement(btn_edit) end
- end
- end
- function setSlotCount(slot, db, duty)
- slot = slot + 1
- item_table[slot] = {item_table[slot][1] or -1, item_table[2] or 0, db, -1, -1, -1, duty}
- triggerServerEvent("updateCount", itemElement, itemElement, slot, db, duty)
- end
- function setSlot(slot, item, val, db, duty)
- slot = slot + 1
- if (not item) then item = 0 end
- if (not val) then val = 0 end
- if (not db) then db = 1 end
- item_table[slot] = {item, val, db, -1, -1, -1, duty}
- triggerServerEvent("setSlotItem", itemElement, itemElement, slot, item, val, db, duty)
- end
- 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 == btn_edit 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 tooltip_items( text, text2 )
- --if checkCursor() then
- local x,y = getCursorPosition( )
- local x,y = x * monitorSize[1], y * monitorSize[2]
- text = tostring( text )
- if text2 then
- text2 = tostring( text2 )
- end
- if text == text2 then
- text2 = nil
- end
- local width = dxGetTextWidth( text, 1, font ) + 20
- if text2 then
- width = math.max( width, dxGetTextWidth( text2, 1, font) + 20 )
- text = text .. "\n" .. text2
- end
- local height = 10 * ( text2 and 5 or 3 )
- x = math.max( 10, math.min( x, monitorSize[1] - width - 10 ) )
- y = math.max( 10, math.min( y, monitorSize[2] - height - 10 ) )
- roundedRectangle( x, y, width, height, tocolor(0, 0, 0, 200), false, true )
- dxDrawText( text, x, y, x + width, y + height, tooltip_text_color, 1, font, "center", "center", false, false, true, true )
- --end
- end
- function roundedRectangle(x, y, w, h, borderColor, bgColor, postGUI)
- if (x and y and w and h) then
- if (not borderColor) then
- borderColor = tocolor(0, 0, 0, 200);
- end
- if (not bgColor) then
- bgColor = borderColor;
- end
- --> Background
- dxDrawRectangle(x, y, w, h, bgColor, postGUI);
- --> Border
- dxDrawRectangle(x + 2, y - 1, w - 4, 1, borderColor, postGUI, true); -- top
- dxDrawRectangle(x + 2, y + h, w - 4, 1, borderColor, postGUI, true); -- bottom
- dxDrawRectangle(x - 1, y + 2, 1, h - 4, borderColor, postGUI, true); -- left
- dxDrawRectangle(x + w, y + 2, 1, h - 4, borderColor, postGUI, true); -- right
- end
- end
- function showItemList()
- if getElementData(localPlayer,"acc:admin") >= 5 then
- if(isElement(gui))then
- showCursor(false)
- destroyElement(gui)
- return
- end
- showCursor(true)
- gui = guiCreateWindow(monitorSize[1]/2-230/2,monitorSize[2]/2-350/2,230,350,"Tárgy lista",false)
- guiWindowSetMovable(gui, false)
- guiWindowSetSizable(gui, false)
- myGrid = guiCreateGridList(0, 25, 220, 280, false, gui)
- guiGridListSetSortingEnabled(myGrid, false)
- myIdColumn = guiGridListAddColumn(myGrid, "Item ID", 0.2)
- myNameColumn = guiGridListAddColumn(myGrid, "Elnevezés", 0.7)
- myGridRows = {}
- for i, v in ipairs(items) do
- myGridRows[i] = guiGridListAddRow(myGrid)
- guiGridListSetItemText(myGrid, myGridRows[i], myIdColumn, i, false, false)
- guiGridListSetItemText(myGrid, myGridRows[i], myNameColumn, v[1], false, false)
- end
- exitButton = guiCreateButton(10, 310, 280, 30, "Kilépés", false, gui)
- addEventHandler("onClientGUIClick", exitButton, function()
- if(source==exitButton)then
- showCursor(false)
- destroyElement(gui)
- end
- end)
- end
- end
- addCommandHandler("is", showItemList)
- addCommandHandler("itemlist", showItemList)
- addCommandHandler("targylista", showItemList)
- function clientPlayerToItem(slot)
- slot = slot + 1
- item_table[slot] = {-1, -1, -1}
- end
- addEvent("clientPlayerToItem", true)
- addEventHandler("clientPlayerToItem", root, clientPlayerToItem)
- --WEAPON
- toggleControl("next_weapon", false)
- toggleControl("previous_weapon", false)
- setTimer(function()
- if not toggleControl("next_weapon", false) then
- toggleControl("next_weapon", false)
- end
- if not toggleControl("previous_weapon", false) then
- toggleControl("previous_weapon", false)
- end
- end, 500, 1)
- function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
- if((getElementData(getLocalPlayer(), "char:weaponInHand") or {-1, -1, -1})[1]>-1)then
- local weaponData = getElementData(getLocalPlayer(), "char:weaponInHand") or {-1, -1, -1}
- local witem = tonumber(weaponData[1] or -1)
- local wslot = tonumber(weaponData[2] or -1)
- local weapon = tonumber(weaponData[3] or -1)
- if(not items[witem][6])then return end
- local slot = 0
- local slots = 0
- local allammo = 0
- for i, v in ipairs(item_table_player) do
- if(tonumber(v[1])==tonumber(items[witem][6]) and tonumber(v[3])>0)then
- slot = i
- slots = i-1
- allammo = allammo + tonumber(v[3])
- end
- end
- if(allammo<=0)then
- triggerServerEvent("toggleGun", getLocalPlayer(), getLocalPlayer(), wslot, witem)
- else
- newCounts = item_table_player[slot][3] - 1
- setSlotCount(slots, newCounts, item_table[slot][7] or -1)
- if item_table_player[slot][3] < 2 then
- delSlot(item_table_player[slots][6])
- end
- end
- end
- end
- addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc )
- addEvent("localMeMsg", true)
- addEventHandler("localMeMsg", root, function(player, msg)
- exports.mta_chat:sendLocalMeMessage(player, msg)
- end)
- function delSlot(slot)
- slot = slot + 1
- item_table[slot] = {-1, -1, -1}
- triggerServerEvent("deleteSlot", itemElement, itemElement, slot)
- end
- --[[ Széf Rendszer --]]
- addCommandHandler("delsafe", function(_, safeID)
- if getElementData(localPlayer, "acc:admin") > 0 then return end
- if not tonumber(safeID) then
- outputChatBox("#F4D03F[Northen Life MTA]#ffffff /delsafe [ID]", 0, 0, 0, true)
- return
- end
- safeID = tonumber(safeID)
- for _, safe in ipairs(getElementsByType("object")) do
- if tonumber(getElementData(safe,"safe->ID")) == safeID then
- if hasItem(localPlayer, 37, getElementData(safe, "safe->ID")) then
- local x,y,z = getElementPosition(getLocalPlayer())
- local x2,y2,z2 = getElementPosition(safe)
- if getDistanceBetweenPoints3D( x, y, z, x2, y2, z2 ) < 5 then
- triggerServerEvent("Items-->DeleteSafes", localPlayer, localPlayer, safe, safeID)
- for i=0,50 do
- local items = getSlot(i)
- local value = getSlotValue(i)
- if tonumber(items) == tonumber(37) and tonumber(value) == safeID then
- delSlot(i)
- end
- end
- else
- outputChatBox("#D24D57[Northen Life MTA] #ffffffTúl messze vagy az adott széftől." ,255, 255, 255, true)
- end
- end
- end
- end
- end)
- addCommandHandler("createsafe", function()
- if getElementData(localPlayer, "acc:admin") < 6 then return end
- triggerServerEvent("item->createSafe", localPlayer, localPlayer)
- outputChatBox("#47a7df[Northen Life MTA] #ffffffSikeresen létrehoztál egy széfet." ,255, 255, 255, true)
- end)
- --[[ Fegyver a háton ]]
- -- function getWeaponModel(weapon)
- -- local m
- -- if weapon > 1 and weapon < 9 then
- -- m = 331 + weapon
- -- elseif weapon == 9 then
- -- m = 341
- -- elseif weapon == 15 then
- -- m = 326
- -- elseif (weapon > 21 and weapon < 30) or (weapon > 32 and weapon < 39) or (weapon > 40 and weapon < 44) then
- -- m = 324 + weapon
- -- elseif weapon > 29 and weapon < 32 then
- -- m = 325 + weapon
- -- elseif weapon == 32 then
- -- m = 372
- -- end
- -- return m
- -- end
- -- local leftSideWeapons = {
- -- [352] = true, --uzi
- -- [353] = true, --mp
- -- [334] = true, --gumibot
- -- }
- -- local rightSideWeapons = {
- -- [348] = true, --deagle
- -- [372] = true, --tec
- -- }
- -- local backSideWeapons = {
- -- [349] = true, --shotgun
- -- [350] = true, --shothun
- -- [351] = true, --shotgun
- -- [355] = true, --ak
- -- [356] = true, --m4
- -- [357] = true, --rifle
- -- [358] = true, --rifle
- -- }
- -- local handbackWeapons = {
- -- [337] = true, --ásó
- -- [336] = true, --bézbóz
- -- [338] = true, --billiárd
- -- [339] = true, --katana
- -- }
- -- local playerWeapons = {}
- -- playerWeapons[getElementData(localPlayer, "acc:id")] = {}
- -- addEvent("getPlayerInventory", true)
- -- addEventHandler("getPlayerInventory", root, function(table)
- -- currentInventory = {}
- -- currentInventory = table
- -- end)
- -- addEventHandler("onClientPreRender", root, function()
- -- if getElementData(localPlayer, "loggedin") then
- -- for key, value in ipairs(getElementsByType("player", true)) do
- -- if getElementData(value, "loggedin") then
- -- local x, y, z = getPedBonePosition(value, 3)
- -- local rot = math.rad(90-getPedRotation(value))
- -- local i = 15
- -- local j = 0
- -- local wep = getPedWeaponSlot(value)
- -- local ox, oy = math.cos(rot)*0.22, -math.sin(rot)*0.22
- -- local alpha = getElementAlpha(value)
- -- if playerWeapons[getElementData(value, "acc:id")] then
- -- for index, weapon in ipairs(playerWeapons[getElementData(value, "acc:id")]) do
- -- if isElement(weapon) then
- -- --if getElementData(value, "char:weaponInHand")[1] or -1 > 0 then
- -- -- if getWeaponModel(items[getElementData(value, "char:weaponInHand")[1]][5]) ~= getElementModel(weapon) then
- -- setElementRotation(weapon, 0, 70, getPedRotation(value)+90)
- -- setElementAlpha(weapon, alpha)
- -- if rightSideWeapons[getElementModel(weapon)] then
- -- local px, py, pz = getPedBonePosition(value, 51)
- -- local qx, qy = math.sin(rot)*0.11, math.cos(rot)*0.11
- -- setElementPosition(weapon, px+qx, py+qy, pz)
- -- elseif leftSideWeapons[getElementModel(weapon)] then
- -- local px, py, pz = getPedBonePosition(value, 41)
- -- local qx, qy = math.sin(rot)*0.06, math.cos(rot)*0.06
- -- setElementPosition(weapon, px-qx, py-qy, pz)
- -- if getElementModel(weapon) == 334 then
- -- local rx, ry, rz = getElementRotation(weapon)
- -- setElementRotation(weapon, rx, ry+110, rz)
- -- end
- -- elseif backSideWeapons[getElementModel(weapon)] then
- -- setElementPosition(weapon, x+ox, y+oy, z-0.2)
- -- setElementRotation(weapon, -17, -(50+i), getPedRotation(value))
- -- i = i + 15
- -- elseif handbackWeapons[getElementModel(weapon)] then
- -- if j % 2 == 0 then
- -- setElementPosition(weapon, x+ox, y+oy, z-0.2)
- -- setElementRotation(weapon, -17, -30, getPedRotation(value))
- -- else
- -- setElementPosition(weapon, x+ox, y+oy, z-0.2)
- -- setElementRotation(weapon, -17, 30, getPedRotation(value))
- -- end
- -- j = j + 1
- -- end
- -- -- end
- -- --end
- -- end
- -- end
- -- end
- -- end
- -- end
- -- end
- -- end)
- -- function streamedIn(source)
- -- if isElement(source) and getElementType(source) == "player" then
- -- local currentPlayer = source
- -- streamedOut(source)
- -- playerWeapons[getElementData(currentPlayer, "acc:id")] = {}
- -- triggerServerEvent("getPlayerItems", localPlayer, currentPlayer)
- -- setTimer(function ()
- -- if not currentInventory then return end
- -- for key, value in ipairs(currentInventory) do
- -- if value and value[1] and (value or {-1, -1})[1] > 0 and items[value[1]][5] or -1 > 0 then
- -- if leftSideWeapons[getWeaponModel(items[value[1]][5])] or rightSideWeapons[getWeaponModel(items[value[1]][5])] or backSideWeapons[getWeaponModel(items[value[1]][5])] or handbackWeapons[getWeaponModel(items[value[1]][5])] then
- -- for index, weapon in ipairs(playerWeapons[getElementData(currentPlayer, "acc:id")]) do
- -- if isElement(weapon) and getElementModel(weapon) == getWeaponModel(items[value[1]][5]) then
- -- destroyElement(weapon)
- -- end
- -- end
- -- local x, y, z = getElementPosition(currentPlayer)
- -- playerWeapons[getElementData(currentPlayer, "acc:id")][#playerWeapons[getElementData(currentPlayer, "acc:id")] + 1] =
- -- createObject(getWeaponModel(items[value[1]][5]), x, y, z)
- -- setElementCollisionsEnabled(playerWeapons[getElementData(currentPlayer, "acc:id")][#playerWeapons[getElementData(currentPlayer, "acc:id")]], false)
- -- outputDebugString(getWeaponModel(items[value[1]][5]) .. " weapon created -> " .. getPlayerName(currentPlayer))
- -- end
- -- end
- -- end
- -- end, 100, 1)
- -- end
- -- end
- -- addEvent("streamedIn", true)
- -- addEventHandler("streamedIn", root, streamedIn)
- -- addEventHandler("onClientElementStreamIn", root, streamedIn)
- -- addEventHandler("onClientVehicleExit", root, function(source)
- -- streamedIn(source)
- -- end)
- -- function streamedOut(source)
- -- if source then
- -- local currentPlayer = source
- -- if playerWeapons[getElementData(currentPlayer, "acc:id")] then
- -- for key, value in ipairs(playerWeapons[getElementData(currentPlayer, "acc:id")]) do
- -- if isElement(value) then
- -- outputDebugString(getElementModel(value) .. " weapon destroyed")
- -- destroyElement(value)
- -- end
- -- end
- -- end
- -- end
- -- end
- -- addEventHandler("onClientElementStreamOut", root, streamedOut)
- -- addEventHandler("onClientPlayerQuit", root, function()
- -- if playerWeapons[getElementData(source, "acc:id")] then
- -- for key, value in ipairs(playerWeapons[getElementData(source, "acc:id")]) do
- -- if isElement(value) then
- -- outputDebugString(getElementModel(value) .. " weapon destroyed")
- -- destroyElement(value)
- -- end
- -- end
- -- end
- -- end)
- -- addEventHandler("onClientPlayerWasted", root, function()
- -- streamedOut(source)
- -- end)
- -- addEventHandler("onClientVehicleEnter", root, function(source)
- -- streamedOut(source)
- -- end)
- -- function loadNearbyWeapons()
- -- setTimer(function()
- -- for key, player in ipairs(getElementsByType("player")) do
- -- setTimer(function()
- -- streamedIn(player)
- -- end, key * 150, 1)
- -- end
- -- end, 200, 1)
- -- end
- -- addEventHandler("onClientResourceStart", resourceRoot, loadNearbyWeapons)
- -- addEventHandler("onClientPlayerSpawn", root, loadNearbyWeapons)
- function ChangeObjectModel (filename,id)
- if id and filename then
- if fileExists("files/" .. filename..".txd") then
- txd = engineLoadTXD( "files/" .. filename..".txd" )
- engineImportTXD( txd, id )
- end
- if fileExists("files/" .. filename..".dff") then
- dff = engineLoadDFF( "files/" .. filename..".dff", 0 )
- engineReplaceModel( dff, id )
- end
- if fileExists("files/" .. filename..".col") then
- col = engineLoadCOL( "files/" .. filename..".col" )
- engineReplaceCOL( col, id )
- end
- engineSetModelLODDistance(id,300)
- end
- end
- ChangeObjectModel("villogo",903)
- ChangeObjectModel("taxitable",2061)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement