Jump to content

Lukkas2201

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by Lukkas2201

  1. Sim eu faço isso, até então funciona de boa, mas quando eu reconecto n oservidor, ai aperto J pra abrir o inventário, não aparece nada. e tipo, eu inicio normal o servidor, ai eu marco a checkbox do inventario modificado, ai eu removo todas as checkbox, e reinicio o servidor, ai funciona, mas só funciona porque a checkbox que está selecionada era ad o inventário modiificado, se eu tivesse deixado selecionada a check box padrão, não iria funcionar, que é o caso quando eu reconecto, quando eu reconecto no servidor, a checkbox volta pra padrão ai quando aperto J não abre o inventário.
  2. Boa noite, estou tentando fazer o seguinte, no servidor tem dois tipos de inventário (padrão e o modificado), vc aperta a Tecla 'J' e ele abre o inventário padrão, porém na hora que ele abre o inventário padrão, se vc apertar um botão ele troca para o inventário modificado, a porém eu queria deixar fixo, para quando apertar J, abrir somente o modificado, e não ter como mudar para o padrão, ou seja, quero que o inventário modificado seja o novo inventário padrão, (o inventário modificado vem de outro script, mas creio que nao preciso postar ele, porque a configuração de abrir está neste script abaixo), se alguém puder me ajudar e me dizer oque fazer, ou onde tenho que alterar algo, eu ficarei grato. o (new_inv) é o inventário modificado. ele vem de outro script que seria uma resource. a função no qual abre o inventário é a "function showInventory(key,keyState)" -----------S1L3NC3 inventoryItems = { ["Primary Weapon"] = {}, ["Secondary Weapon"] = {}, ["Specially Weapon"] = {}, ["Pistols"] = {}, ["Ammo"] = {}, ["Food"] = { {"Canned Spaghetti (Fechado)",1,"","Espaguete enlatado fechado, necessário o item *Opener* para abrir. \nClique 2x para abrir."}, {"Canned Spaghetti (Aberto)",1,"","Espaguete enlatado aberto.\nPara comer clique 2x"}, {"Canned Baked Beans (Fechado)",1,"","Feijão enlatado fechado, necessário o item *Opener* para abrir. \nClique 2x para abrir."}, {"Canned Baked Beans (Aberto)",1,"","Feijão enlatado aberto.\nPara comer clique 2x"}, {"Canned Sardines (Fechado)",1,"","Sardinha enlatada fechada, necessário o item *Opener* para abrir. \nClique 2x para abrir."}, {"Canned Sardines (Aberto)",1,"","Sardinha enlatada aberta.\nPara comer clique 2x"}, {"Can of Tactical Bacon (Fechado)",1,"","Bacon enlatado fechado, necessário o item *Opener* para abrir. \nClique 2x para abrir."}, {"Can of Tactical Bacon (Aberto)",1,"","Bacon enlatado aberto.\nPara comer clique 2x"}, {"Water Bottle",1,"","Garrafa de água.\nPara beber clique 2x"}, {"Burger",1,"","Burguer.\nPara comer clique 2x"}, {"Pizza",1,"","Pizza\nPara comer clique 2x"}, {"Soda Bottle",1,"","Soda Bottle.\nPara beber clique 2x"}, {"Milk",1,"","Milk.\nPara beber clique 2x"}, {"Cooked Meat",1,"","Carne Assada.\nPara comer clique 2x"}, {"Raw Meat",1,"","Carne Crua.\nPara assar é necessário o acender um Wood Pile\nPara Assar clique com o scroll do mouse no Wood Pile"}, }, ["Medic"] = { {"Antibiotics",1,"Usar","Antibiotcs"}, {"Bandage",1,"Usar","Bandage, usado para estancar curativos.\nPara usar clique 2x"}, {"Medic Kit",2,"Usar","Medic Kit, usado para aumentar o blood.\nPara usar clique 2x"}, {"Heat Pack",1,"Usar","Heat Pack.\nPara usar clique 2x"}, {"Painkiller",1,"Usar","Painkiller, usado para aliviar dores de cabeça.\nPara usar clique 2x"}, {"Blood Bag",1,"Usar","Blood Bag, bolsa de sangue, usado para aumentar o blood de outro player.\nPara usar se aproxime do player, e clique com o scrol do mouse em *Administer Blood Bag*"}, {"Morphine",1,"Usar","Morphine, usado para curar ossos quebrados.\nPara usar clique 2x"}, }, ["VehicleParts"] = { {"Engine",5,"","Motor, usado em veículos, necessário o item *Toolbox* para colocar no veículo.\nPara colocar no veículo aperta o Scrol do mouse em *Colocar Engine*"}, {"Tire",2,"","Pneu, usado em veículos, necessário o item *Toolbox* para colocar no veículo.\nPara colocar no veículo aperta o Scrol do mouse em *Colocar Tire*"}, {"Tank Parts",3,"","Tanque de Gasolina, usado em veículos, necessário o item *Toolbox* para colocar no veículo.\nPara colocar no veículo aperta o Scrol do mouse em *Colocar Tank Parts*"}, {"Scrap Metal",1,"","Ferramenta utilizada para reparar veículos, necessário o item *Toolbox* junto para poder reparar.\nPara colocar no veículo aperta o Scrol do mouse em *Reparar Veículo*"}, {"Steel Sheet",1,"","Armadura para veículos.\nPara colocar no veículo aperta o Scrol do mouse em *Colocar Steel Sheet*"}, {"Empty Gas Canister",2,"","Galão de Gasolina Vazio, para encher, vá até um posto de gasolina\nPara encher, aproxime-se da bomba de gasolina, e clique com o scroll do mouse."}, {"Full Gas Canister",2,"","Galão de Gasolina cheio\nPara abastecer o veículo, clique com o Scrol do mouse em *Colocar Gasolina*."}, }, ["Items"] = { {"Stinger",3,"Place Stinger","Tapete de pregos, usado para furar pneu de veículos.\nPara usar clique 2x."}, {"Wood Pile",2,"","Fogueira, necessários o item *Box Of Matches* para acender."}, {"Roadflare",1,"Place","Quando colocado, acende uma luz bem forte, para chamar atenção de outros players\nClique 2x para colocar."}, {"Wire Fence",1,"Colocar Wire Fence","Cerca de Arame (Para remover ela, necessário item *Toolbox*\nClique 2x para colocar."}, {"Tent",3,"Pitch a Tent","Tenda, usado para guardar itens.\nPara montar, clique 2x."}, {"Empty Water Bottle",1,"","Garrafa de água vazia\nPara encher, vá até o mar, e clique 2x."}, {"Empty Soda Cans",1,"","Lata de soda vazia."}, }, ["Roupas"] = { }, ["Mochilas"] = { }, ["Toolbelt"] = { {"Night Vision Goggles",0,"","Visão noturna, usado para enxergar melhor a noite.\nPara ativar aperte a tecla N"}, {"Infrared Goggles",0,"","Visão infra vermelho, usado para enxergar melhor os objetos e inimigos\nPara ativar aperte a tecla I"}, {"Map",0,"","Mapa\nPara usar aperte F11"}, {"Box of Matches",0,"Make a Fire","Esqueiro, usado para acender fogueira (necessário item *Wood Pile*\nPara acender se aproxime da fogueira e clique com o scrol do mouse.",}, {"Watch",0,"","Relógio"}, {"GPS",0,"Set Rate","Radar, usado para setar frequência e encontrar outros players"}, -- se for ativar frequencia do gps "Set Rate" {"Toolbox",0,"","Caixa de Ferramentas, usado para colocar peças em veículos, remover wire fences e stingers"}, {"Radio Device",0,"","Usado em veículos para poder ouvir rádio"}, {"Syringe",0,"","Siringa"}, {"Opener",0,"","Usado para abrir comidas fechadas"}, {"Hose",0,"","Mangueira, usada para retirar gasolina de um veículo.\nPara retirar gasolina, ela precisa estar acima de 20 no veículo, clique com o scrol do mouse em *Retirar Gasolina*."}, {"Tire Repair Kit",0,"","Kit de Reparos de pneu"}, {"Compass",0,"","Kit de Reparos de pneu"}, }} local sacks = { {"Smersh Backpack",10}, {"Courier Bag",11}, {"Child Briefcase",12}, {"Improvised Backpack",14}, {"Assault Pack (ACU)",16}, {"Alice Pack",18}, {"British Assault Pack",20}, {"Taloon Backpack",22}, {"Omega Backpack",24}, {"Alfa Backpack",26}, {"Hunting Backpack",28}, {"Camping Backpack",30}, {"Drybag Backpack",32}, {"Mountain Backpack",36}, {"Czech Backpack",40}, {"Camping Tactical Backpack",42}, {"Coyote Backpack",44}, {"Coyote Backpack (Desert)",45}, {"Coyote Backpack (Mossy)",46}, {"Tactical Backpack",48}, {"Eskimo Backpack",50}, {"Tiger Backpack",55}, {"Noel Backpack",68}, } addEventHandler("onClientResourceStart",resourceRoot,function() for i,weaponData in pairs(weaponTable)do if weaponData[5] == 1 then table.insert(inventoryItems["Primary Weapon"],{weaponData[1],3,weaponData[2],weaponData[11]}) elseif weaponData[5] == 2 then if weaponData[2] == "others" then table.insert(inventoryItems["Secondary Weapon"],{weaponData[1],2,weaponData[1],weaponData[11]}) else table.insert(inventoryItems["Secondary Weapon"],{weaponData[1],2,weaponData[2],weaponData[11]}) end elseif weaponData[5] == 3 then table.insert(inventoryItems["Specially Weapon"],{weaponData[1],1,weaponData[1],weaponData[11]}) elseif weaponData[5] == 4 then table.insert(inventoryItems["Pistols"],{weaponData[1],2,weaponData[2],weaponData[11]}) end if weaponData[2] ~= "others" then add = true for i,weaponData2 in pairs(inventoryItems["Ammo"])do if weaponData[2] == weaponData2[1] then add = false inventoryItems["Ammo"][i][4] = inventoryItems["Ammo"][i][4]..";\n"..weaponData[1] end end if add then table.insert(inventoryItems["Ammo"],{weaponData[2],weaponData[8],"","Ammo for:\n"..weaponData[1]}) end end end end) for i,vestData in pairs(VestsTable)do table.insert(inventoryItems["Items"],{vestData[1],1,"Use Vest",vestData[7]}) end for i,helmetData in pairs(HelmetsTable)do table.insert(inventoryItems["Items"],{helmetData[1],1,"Use Helmet",helmetData[7]}) end for i,bpData in pairs(BackpacksTable)do table.insert(inventoryItems["Items"],{bpData[1],1,"Wear Backpack","Backpack with "..bpData[2].." Slots"}) end -- убрать ------------------------------------------------------------------------------ --INVENTORY local headline = {} pname = getPlayerName(getLocalPlayer()):gsub('#%x%x%x%x%x%x',''):gsub('#%x%x%x%x%x%x','') inv_window = guiCreateWindow(0.15, 0.28, 0.72, 0.63,pname.."' Inventory", true) guiWindowSetSizable(inv_window, false) guiSetVisible(inv_window,false) InvImage = guiCreateStaticImage(0.01,0.03,1.99,100,"images/inventory.png",true,inv_window) guiSetAlpha(InvImage,1) guiSetProperty(InvImage,"Disabled","true") InventoryLabel = guiCreateLabel(0.58, 0.05, 0.39, 0.03, "Inventory", true, inv_window) guiSetFont(InventoryLabel, "default-bold-small") guiLabelSetHorizontalAlign(InventoryLabel, "center", false) LootLabel = guiCreateLabel(0.03, 0.05, 0.39, 0.03, "Gear", true, inv_window) guiSetFont(LootLabel, "default-bold-small") guiLabelSetHorizontalAlign(LootLabel, "center", false) loot_grid = guiCreateGridList(0.03, 0.10, 0.39, 0.83, true, inv_window) guiGridListSetSortingEnabled(loot_grid,false) loot_lootcolumn = guiGridListAddColumn(loot_grid,"Loot",0.7) loot_amountcolumn = guiGridListAddColumn(loot_grid,"Amount",0.2) inv_itemsgrid = guiCreateGridList(0.58, 0.11, 0.39, 0.83, true, inv_window) guiGridListSetSortingEnabled(inv_itemsgrid,false) inv_itemscolumn = guiGridListAddColumn(inv_itemsgrid,"Inventory",0.7) inv_amountcolumn = guiGridListAddColumn(inv_itemsgrid,"Amount",0.2) loot_takebutton = guiCreateButton(0.42, 0.17, 0.04, 0.69, "->", true, inv_window) guiSetFont(loot_takebutton, "default-bold-small") inv_dropbutton = guiCreateButton(0.53, 0.17, 0.04, 0.69, "<-", true, inv_window) guiSetFont(inv_dropbutton, "default-bold-small") inv_slotslabel = guiCreateLabel(0.62, 0.94, 0.29, 0.04, "Slots:", true, inv_window) guiSetFont(inv_slotslabel, "default-bold-small") guiLabelSetHorizontalAlign(inv_slotslabel, "center", false) guiLabelSetVerticalAlign(inv_slotslabel, "center") loot_amountlabel = guiCreateLabel(0.07, 0.94, 0.29, 0.04, "Empty", true, inv_window) guiSetFont(loot_amountlabel, "default-bold-small") guiLabelSetHorizontalAlign(loot_amountlabel, "center", false) guiLabelSetVerticalAlign(loot_amountlabel, "center") HideGear = guiCreateCheckBox(0.03,0.05,0.11,0.04,"Hide Gear",true,true,inv_window) guiSetFont(HideGear,"default-bold-small") SetGPSRateWindow = guiCreateWindow(0.42,0.45,0.08,0.13,"Set GPS Rate",true) guiWindowSetSizable(SetGPSRateWindow,false) guiSetVisible(SetGPSRateWindow,false) GPSRate = guiCreateEdit(0.10,0.25,0.81,0.25,"",true,SetGPSRateWindow) SetGPSRate = guiCreateButton(0.10,0.61,0.81,0.29,"Set",true,SetGPSRateWindow) guiSetFont(SetGPSRate,"default-bold-small") guiSetProperty(SetGPSRateWindow,"AlwaysOnTop","True") x,y = guiGetScreenSize() x2,y2 = guiGetSize(inv_window,false) x3,y3 = guiGetSize(SetGPSRateWindow,false) guiSetPosition(inv_window,x/2-x2/2,y/2-y2/2,false) guiSetPosition(SetGPSRateWindow,x/2-x3/2,y/2-y3/2,false) addEventHandler("onClientGUIClick",getResourceRootElement(getThisResource()),function() if source == SetGPSRate then rate = guiGetText(GPSRate) if rate ~= "" and tonumber(rate) then guiSetVisible(SetGPSRateWindow,false) setElementData(getLocalPlayer(),"GPSChannel",rate) else outputChatBox("Type a number!") end end end) local sW, sH = guiGetScreenSize() local topChangeButtonsParent = guiCreateLabel(100,100,100,30,"",false) local middleOnButton = guiCreateRadioButton ( 0,0,100, 15, "",false, topChangeButtonsParent) guiCreateRadioButton ( 0,15,100, 15, "",false, topChangeButtonsParent) guiRadioButtonSetSelected ( middleOnButton, true ) local bottomChangeButtonsParent = guiCreateLabel(100,100,100,30,"",false) local inventoryOnButton = guiCreateRadioButton ( 0,0,100, 15, "",false, bottomChangeButtonsParent) local inventoryOffButton = guiCreateRadioButton ( 0,15,100, 15, "",false, bottomChangeButtonsParent) guiRadioButtonSetSelected ( inventoryOnButton, true ) function changeMiddleVisible() exports.new_inv:setMiddleVisible(guiRadioButtonGetSelected(middleOnButton)) local x, top, bottom = exports.new_inv:getRadioButtonsCoords() guiSetPosition(topChangeButtonsParent,x,top,false) guiSetPosition(bottomChangeButtonsParent,x,bottom,false) end addEventHandler("onClientGUIClick",topChangeButtonsParent, changeMiddleVisible ) guiSetVisible(topChangeButtonsParent,false) function changeInventoryVisible() setElementData(localPlayer,"dayz:new_inv",guiRadioButtonGetSelected(inventoryOnButton)) if not guiRadioButtonGetSelected(inventoryOnButton) then exports.new_inv:hideNewInventory() else guiSetVisible(inv_window,false) hideRightClickInventoryMenu () end showInventory(nil,"down") guiSetVisible(bottomChangeButtonsParent,true) end addEventHandler("onClientGUIClick",bottomChangeButtonsParent, changeInventoryVisible ) guiSetVisible(bottomChangeButtonsParent,false) function showInventory(key,keyState) if getElementData(getLocalPlayer(),"cantOpenInv") then return end hideRightClickInventoryMenu() guiSetVisible(InfoWindow,false) local col = getElementData(getLocalPlayer(),"currentCol") local gearName = getElementData(getLocalPlayer(),"lootname") refreshLoot(col,gearName) if getElementData(getLocalPlayer(),"logedin") and keyState == "down" then local x, top, bottom = exports.new_inv:getRadioButtonsCoords() if getElementData ( localPlayer, "dayz:new_inv") then -- ESSE NEW_INV É O INVENTÁRIO MODIFICADO, O QUAL QUERO DEIXAR COMO PADRÃO guiRadioButtonSetSelected ( inventoryOnButton, true ) guiSetVisible(topChangeButtonsParent,not guiGetVisible(topChangeButtonsParent)) guiSetPosition(topChangeButtonsParent,x,top,false) guiSetPosition(bottomChangeButtonsParent,x,bottom,false) guiSetVisible(bottomChangeButtonsParent,not guiGetVisible(bottomChangeButtonsParent)) local show = exports.new_inv:showNewInventory() if show then onClientOpenInventoryStopMenu () end showCursor(show) return else guiRadioButtonSetSelected ( inventoryOffButton, true ) guiSetVisible(topChangeButtonsParent,false) end if guiGetVisible(inv_window) then --- AQUI É O INVENTÁRIO PADRÃO guiSetVisible(inv_window,false) guiSetVisible(SetGPSRateWindow,false) --guiSetVisible(SetGPSRateWindow,false) showCursor(false) guiSetVisible(bottomChangeButtonsParent,false) else guiSetVisible(inv_window,true) showCursor(true) guiSetPosition(bottomChangeButtonsParent,0.14*sW+0.72*sW,0.18*sH+0.63*sH-30,false) guiSetVisible(bottomChangeButtonsParent,true) end guiSetVisible(HideGear,false) if isPlayerInLoot() then if getElementData(col,"tent") then guiSetVisible(HideGear,true) if getElementData(col,"visible") then guiCheckBoxSetSelected(HideGear,false) else guiCheckBoxSetSelected(HideGear,true) end end end refreshInventory() if guiGetVisible(inv_window)== true then onClientOpenInventoryStopMenu() end end end bindKey("j","down",showInventory) addEventHandler("onClientGUIClick",HideGear,function() col = isPlayerInLoot() if col then if guiCheckBoxGetSelected(HideGear) then setElementData(col,"visible",false) else setElementData(col,"visible",true) end end end) function Debugg() setElementData(getLocalPlayer(),"loot",false) end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),Debugg) function showInventoryManual() if getElementData(localPlayer,"dayz:new_inv") then exports.new_inv:showNewInventory() return end guiSetVisible(inv_window,not guiGetVisible(inv_window)) showCursor(not isCursorShowing()) refreshInventory() if guiGetVisible(inventoryWindows)== true then onClientOpenInventoryStopMenu() end end function hideInventoryManual() guiSetVisible(inv_window,false) guiSetVisible(topChangeButtonsParent,false) guiSetVisible(bottomChangeButtonsParent,false) showCursor(false) if getElementData ( localPlayer, "dayz:new_inv") then return end hideRightClickInventoryMenu() end addEvent("hideInventoryManual",true) addEventHandler("hideInventoryManual",getLocalPlayer(),hideInventoryManual) function refreshInventoryManual() if getElementData ( localPlayer, "dayz:new_inv") then return end refreshInventory() end addEvent("refreshInventoryManual",true) addEventHandler("refreshInventoryManual",getLocalPlayer(),refreshInventoryManual) function refreshLootManual(loot) refreshLoot(loot) end addEvent("refreshLootManual",true) addEventHandler("refreshLootManual",getLocalPlayer(),refreshLootManual) function getMyInventory() local myInventory = {} for id, item in ipairs(inventoryItems["Primary Weapon"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Secondary Weapon"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Pistols"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Specially Weapon"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Ammo"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Food"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Medic"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["VehicleParts"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Items"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Toolbelt"]) do local quant = getElementData(getLocalPlayer(),item[1]) if quant and quant >= 1 then table.insert(myInventory,{item[1],quant}) end end return myInventory end function getLootInventory() local lootInventory = {} if not isElement (isPlayerInLoot()) then return false end for id, item in ipairs(inventoryItems["Primary Weapon"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Secondary Weapon"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Pistols"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Specially Weapon"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Ammo"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Food"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Medic"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["VehicleParts"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Items"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end for id, item in ipairs(inventoryItems["Toolbelt"]) do local quant = getElementData(isPlayerInLoot(),item[1]) if quant and quant >= 1 then table.insert(lootInventory,{item[1],quant}) end end return lootInventory end function getMySlots() vestSlots = getActiveVestSlots(getLocalPlayer()) if vestSlots then return {getPlayerCurrentSlots()+vestSlots,getPlayerMaxAviableSlots()+vestSlots} else return {getPlayerCurrentSlots(),getPlayerMaxAviableSlots()} end end function getLootSlots() if not isElement (isPlayerInLoot()) then return {0,0} else return {getLootCurrentSlots(isPlayerInLoot()),getLootMaxAviableSlots(isPlayerInLoot())} end end function refreshInventory() if(inv_itemscolumn) then row1,column1 = guiGridListGetSelectedItem(inv_itemsgrid) guiGridListClear(inv_itemsgrid) local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Primary Weapon",true,false) for id,item in ipairs(inventoryItems["Primary Weapon"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_1") and item[1] == getElementData(getLocalPlayer(),"currentweapon_1") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255,0,0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255,0,0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Secondary Weapon",true,false) for id,item in ipairs(inventoryItems["Secondary Weapon"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_2") and item[1] == getElementData(getLocalPlayer(),"currentweapon_2") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255,0,0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255,0,0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Pistols",true,false) for id,item in ipairs(inventoryItems["Pistols"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_4") and item[1] == getElementData(getLocalPlayer(),"currentweapon_4") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255,0,0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255,0,0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Specially Weapon",true,false) for id,item in ipairs(inventoryItems["Specially Weapon"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_3") and item[1] == getElementData(getLocalPlayer(),"currentweapon_3") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255,0,0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255,0,0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Ammo",true,false) for id,item in ipairs(inventoryItems["Ammo"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Foods / Drinks",true,false) for id,item in ipairs(inventoryItems["Food"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Medic",true,false) for id,item in ipairs(inventoryItems["Medic"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Vehicle Parts",true,false) for id,item in ipairs(inventoryItems["VehicleParts"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Misc",true,false) for id,item in ipairs(inventoryItems["Items"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getActiveVest(getLocalPlayer()) == item[1] then guiGridListSetItemColor(inv_itemsgrid,row,inv_itemscolumn,0,255,0) guiGridListSetItemColor(inv_itemsgrid,row,inv_amountcolumn,0,255,0) end if getActiveHelmet(getLocalPlayer()) == item[1] then guiGridListSetItemColor(inv_itemsgrid,row,inv_itemscolumn,0,255,0) guiGridListSetItemColor(inv_itemsgrid,row,inv_amountcolumn,0,255,0) end for i=1,#BackpacksTable do if item[1] == BackpacksTable[i][1] then if BackpacksTable[i][2] == getElementData(getLocalPlayer(),"MAX_Slots") then guiGridListSetItemColor(inv_itemsgrid,row,inv_itemscolumn,255,0,0) guiGridListSetItemColor(inv_itemsgrid,row,inv_amountcolumn,255,0,0) end end end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Toolbelt",true,false) for id,item in ipairs(inventoryItems["Toolbelt"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end if row1 and column1 then guiGridListSetSelectedItem(inv_itemsgrid,row1,column1) end vestSlots = getActiveVestSlots(getLocalPlayer()) if vestSlots then guiSetText(inv_slotslabel,"Slots: "..getPlayerCurrentSlots()+vestSlots.."/"..getPlayerMaxAviableSlots().." + "..vestSlots) else guiSetText(inv_slotslabel,"Slots: "..getPlayerCurrentSlots().."/"..getPlayerMaxAviableSlots()) end end end function refreshLoot(loot,gearName) if loot == false then guiGridListClear(loot_grid) guiSetText(loot_amountlabel,"Empty") guiSetText(LootLabel,"Gear") return end if(loot_lootcolumn) then row2,column2 = guiGridListGetSelectedItem(loot_grid) guiGridListClear(loot_grid) if gearName then guiSetText(LootLabel,gearName) end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Primary Weapon",true,false) for id,item in ipairs(inventoryItems["Primary Weapon"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Secondary Weapon",true,false) for id,item in ipairs(inventoryItems["Secondary Weapon"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Pistols",true,false) for id,item in ipairs(inventoryItems["Pistols"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Specially Weapon",true,false) for id,item in ipairs(inventoryItems["Specially Weapon"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Ammo",true,false) for id,item in ipairs(inventoryItems["Ammo"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Foods / Drinks",true,false) for id,item in ipairs(inventoryItems["Food"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Medic",true,false) for id,item in ipairs(inventoryItems["Medic"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Vehicle Parts",true,false) for id,item in ipairs(inventoryItems["VehicleParts"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Misc",true,false) for id,item in ipairs(inventoryItems["Items"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Toolbelt",true,false) for id,item in ipairs(inventoryItems["Toolbelt"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end if row2 and column2 then guiGridListSetSelectedItem(loot_grid,row2,column2) end guiSetText(loot_amountlabel,"Slots: "..getLootCurrentSlots(loot).."/"..(getLootMaxAviableSlots(loot)or 0)) end end function getPlayerMaxAviableSlots() return getElementData(getLocalPlayer(),"MAX_Slots") end function getLootMaxAviableSlots(loot) return getElementData(loot,"MAX_Slots") end function getPlayerCurrentSlots() local current_SLOTS = 0 for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then current_SLOTS = current_SLOTS + item[2]*getElementData(getLocalPlayer(),item[1]) end end end if getActiveVest(getLocalPlayer()) then current_SLOTS = current_SLOTS - getActiveVestSlots(getLocalPlayer()) end if isWeaponEquiped(1) then current_SLOTS = current_SLOTS - 3 end if isWeaponEquiped(2) then current_SLOTS = current_SLOTS - 2 end if isWeaponEquiped(3) then current_SLOTS = current_SLOTS - 1 end if isWeaponEquiped(4) then current_SLOTS = current_SLOTS - 2 end return math.floor(current_SLOTS) end function getLootCurrentSlots(loot) local current_SLOTS = 0 for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then current_SLOTS = current_SLOTS + item[2]*getElementData(loot,item[1]) end end end return math.floor(current_SLOTS) end function getItemSlots(ItemName) for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if ItemName == item[1] then return item[2] end end end return false end function isToolbeltItem(ItemName) for id,item in ipairs(inventoryItems["Toolbelt"])do if ItemName == item[1] then return true end end return false end function getItemInfo(ItemName) for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if ItemName == item[1] then return item[4] end end end return false end function playerMoveItemOutOfInventory(itemName) if getElementData(localPlayer,"dayz:new_inv") or source == inv_dropbutton then if getElementData(getLocalPlayer(),"CantUseInv") then stateCounter = getElementData(getLocalPlayer(),"PingCounter") if not stateCounter then stateCounter = 0 end setElementData(getLocalPlayer(),"PingCounter",stateCounter + 1) end if playerMovedInInventory then startRollMessage2("Inventory","Abusing exploits will result in a ban!",255,22,0)return end if not getElementData(localPlayer,"dayz:new_inv") then itemName = guiGridListGetItemText(inv_itemsgrid,guiGridListGetSelectedItem(inv_itemsgrid),1) end if getElementData(getLocalPlayer(),itemName) and getElementData(getLocalPlayer(),itemName)>= 1 then if isPlayerInLoot() then local isVehicle = getElementData(isPlayerInLoot(),"vehicle") local isTent = getElementData(isPlayerInLoot(),"tent") if isVehicle and not isTent then if isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol"))+ getItemSlots(itemName)<= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory","Inventory is full!",255,22,0) return end elseif isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol"))+ getItemSlots(itemName)<= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory","Inventory is full!",255,22,0) return end else triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) end end if getElementData(localPlayer,"dayz:new_inv") then setTimer(triggerEvent,200,2,"refreshInventoryManual",localPlayer) return end local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) if isPlayerInLoot() then setTimer(refreshLoot,200,2,col,gearName) end end end addEventHandler("onClientGUIClick",inv_dropbutton,playerMoveItemOutOfInventory) function onPlayerMoveItemOutOFInventory(itemName,loot) keyState = getKeyState("lalt") itemPlus = getAmmoPlus(itemName) for i,weaponData in pairs(weaponTable)do if weaponData[1] == itemName then triggerServerEvent("removeBackWeaponOnDrop",getLocalPlayer()) end end if not getElementData(loot,"itemloot") and getElementType(getElementData(loot,"parent")) == "vehicle" then end if getActiveVest(getLocalPlayer()) == itemName and getElementData(getLocalPlayer(),itemName) == 1 then startRollMessage2("Inventory","You can't drop your current vest!",255,22,0) return end if getActiveHelmet(getLocalPlayer()) == itemName and getElementData(getLocalPlayer(),itemName) == 1 then startRollMessage2("Inventory","You can't drop your current helmet!",255,22,0) return end if (getElementData(getLocalPlayer(),"wearingBackpack") == itemName) and (getElementData(getLocalPlayer(),getElementData(getLocalPlayer(),"wearingBackpack")) == 1) then startRollMessage2("Inventory","You can't drop your current backpack!",255,22,0) return end if itemPlus > getElementData(getLocalPlayer(),itemName) then itemPlus = getElementData(getLocalPlayer(),itemName) end if loot then if getElementType(loot)== "player" then triggerServerEvent("giveItemToAnotherPlayer",getLocalPlayer(),itemName,itemPlus) else avaliableSlotss = getLootMaxAviableSlots(loot) - getLootCurrentSlots(loot) if keyState then movingg = math.floor(avaliableSlotss/getItemSlots(itemName)) if movingg > getElementData(getLocalPlayer(),itemName) then movingg = getElementData(getLocalPlayer(),itemName) end setElementData(loot,itemName,(getElementData(loot,itemName)or 0)+ movingg) else setElementData(loot,itemName,(getElementData(loot,itemName)or 0)+ itemPlus) end local players = getElementsWithinColShape(loot,"player") if #players > 1 then triggerServerEvent("onPlayerChangeLoot",getRootElement(),loot) end end else triggerServerEvent("playerDropAItem",getLocalPlayer(),itemName,itemPlus) setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- itemPlus) return end if keyState then setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- movingg) else setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- itemPlus) end if loot and getElementData(loot,"itemloot") then triggerServerEvent("refre:~emLoot",getRootElement(),loot,getElementData(loot,"parent")) end end addEvent("onPlayerMoveItemOutOFInventory",true) addEventHandler("onPlayerMoveItemOutOFInventory",getRootElement(),onPlayerMoveItemOutOFInventory) function playerMoveItemInInventory(itemName) if getElementData(localPlayer,"dayz:new_inv") or source == loot_takebutton then if getElementData(getLocalPlayer(),"CantUseInv") then stateCounter = getElementData(getLocalPlayer(),"PingCounter") if not stateCounter then stateCounter = 0 end setElementData(getLocalPlayer(),"PingCounter",stateCounter + 1) end if not getElementData(localPlayer,"dayz:new_inv") then itemName = guiGridListGetItemText(loot_grid,guiGridListGetSelectedItem(loot_grid),1) end if isPlayerInLoot() then if getElementData(isPlayerInLoot(),itemName) and getElementData(isPlayerInLoot(),itemName)>= 1 then if not isToolbeltItem(itemName) then if getPlayerCurrentSlots()+ getItemSlots(itemName)<= getPlayerMaxAviableSlots() then if not playerMovedInInventory then triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory","Abusing exploits will result in a ban!",255,22,0) return end else startRollMessage2("Inventory","Inventory is full!",255,22,0) return end else playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end end if getElementData(localPlayer,"dayz:new_inv") then setTimer(triggerEvent,200,2,"refreshInventoryManual",localPlayer) return end if isPlayerInLoot() then local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) setTimer(refreshLoot,200,2,col,gearName) end end end end addEventHandler("onClientGUIClick",loot_takebutton,playerMoveItemInInventory) function onPlayerMoveItemInInventory(itemName,loot) itemPlus = getAmmoPlus(itemName) if loot then if itemPlus > (getElementData(loot,itemName)or 0) then itemPlus = getElementData(loot,itemName) or 1 end if getElementType(loot)== "player" then triggerServerEvent("takeItemToAnotherPlayer",getLocalPlayer(),itemName,itemPlus) else local avaliableSlotss = getPlayerMaxAviableSlots() - getPlayerCurrentSlots() if keyState then movingg = math.floor(avaliableSlotss/getItemSlots(itemName)) if movingg > getElementData(loot,itemName) then movingg = getElementData(loot,itemName) end setElementData(getLocalPlayer(),itemName,(getElementData(getLocalPlayer(),itemName)or 0)+ movingg) else setElementData(getLocalPlayer(),itemName,(getElementData(getLocalPlayer(),itemName)or 0)+ itemPlus) end if itemPlus > 0 then if keyState then setElementData(loot,itemName,(getElementData(loot,itemName)or 0)- movingg) else setElementData(loot,itemName,getElementData(loot,itemName)- itemPlus) end end local players = getElementsWithinColShape(loot,"player") if #players > 1 then triggerServerEvent("onPlayerChangeLoot",getRootElement(),loot) end end if getElementData(loot,"itemloot") then triggerServerEvent("refre:~emLoot",getRootElement(),loot,getElementData(loot,"parent")) end end end addEvent("onPlayerMoveItemInInventory",true) addEventHandler("onPlayerMoveItemInInventory",getRootElement(),onPlayerMoveItemInInventory) function onClientOpenInventoryStopMenu() triggerEvent("disableMenu",getLocalPlayer()) end function isPlayerInLoot() if getElementData(getLocalPlayer(),"loot") then return getElementData(getLocalPlayer(),"currentCol") end return false end ------------------------------------------------------------------------------ --right-click menu function onPlayerPressRightKeyInInventory(itemName) if not getElementData(localPlayer,"dayz:new_inv") then itemName = guiGridListGetItemText(inv_itemsgrid,guiGridListGetSelectedItem(inv_itemsgrid),1) end local itemName,itemInfo = getInventoryInfosForRightClickMenu(itemName) if isCursorShowing() and ( guiGetVisible(inv_window) or getElementData(localPlayer,"dayz:new_inv") ) and itemInfo then if itemName == "Box of Matches" then if getElementData(getLocalPlayer(),"Wood Pile")== 0 then return end end if itemName == "Bandage" then if getElementData(getLocalPlayer(),"bleeding")== 0 then return end end if itemName == "Medic Kit" then if getElementData(getLocalPlayer(),"blood")> 10500 then return end end if itemName == "Heat Pack" then if getElementData(getLocalPlayer(),"temperature")> 35 then return end end if itemName == "Painkiller" then if not getElementData(getLocalPlayer(),"pain") then return end end if itemName == "Canned Spaghetti (Fechado)" or itemName == "Canned Baked Beans (Fechado)" or itemName == "Can of Tactical Bacon (Fechado)" or itemName == "Canned Sardines (Fechado)" then if getElementData(getLocalPlayer(),"Opener")== 0 then return end end if itemName == "Morphine" then if not getElementData(getLocalPlayer(),"brokenbone") then return end end if itemName == "Blood Bag" then return end if itemName == getElementData(getLocalPlayer(),"wearingBackpack") then itemInfo = "Remove Backpack" end if itemName == getActiveVest(getLocalPlayer()) then itemInfo = "Remove Vest" end if itemName == getActiveHelmet(getLocalPlayer()) then itemInfo = "Remove Helmet" end -- убрать if itemInfo ~= "" then playerUseItem(itemName,itemInfo) end end end addEventHandler("onClientGUIDoubleClick",inv_itemsgrid,onPlayerPressRightKeyInInventory,false) function onPlayerPressRightKeyInInventory2() local itemName = guiGridListGetItemText(inv_itemsgrid,guiGridListGetSelectedItem(inv_itemsgrid),1) local itemName,itemInfo = getInventoryInfosForRightClickMenu(itemName) if guiGetVisible(inv_window) and itemName then showRightClickInventoryMenu2(itemName) end end bindKey("mouse2","down",onPlayerPressRightKeyInInventory2) function getInventoryInfosForRightClickMenu(itemName) for i,itemInfo in ipairs(inventoryItems["Primary Weapon"])do if itemName == itemInfo[1] then return itemName,"Equip Primary Weapon" end end for i,itemInfo in ipairs(inventoryItems["Secondary Weapon"])do if itemName == itemInfo[1] then return itemName,"Equip Secondary Weapon" end end for i,itemInfo in ipairs(inventoryItems["Pistols"])do if itemName == itemInfo[1] then return itemName,"Equip Pistol" end end for i,itemInfo in ipairs(inventoryItems["Specially Weapon"])do if itemName == itemInfo[1] then return itemName,"Equip Specially Weapon" end end for i,itemInfo in ipairs(inventoryItems["Ammo"])do if itemName == itemInfo[1] then return itemName,false end end for i,itemInfo in ipairs(inventoryItems["Food"])do if itemName == itemInfo[1] then if itemInfo[1] == "Water Bottle" or itemInfo[1] == "Milk" or itemInfo[1] == "Soda Bottle" then info = "Drink" elseif itemInfo[1] == "Canned Baked Beans (Fechado)" or itemInfo[1] == "Canned Spaghetti (Fechado)" or itemInfo[1] == "Canned Sardines (Fechado)" or itemInfo[1] == "Can of Tactical Bacon (Fechado)" then info = "Open" else info = "Eat" end return itemName,info end end for i,itemInfo in ipairs(inventoryItems["Items"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["Medic"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["VehicleParts"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["Toolbelt"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end end ------------------------------ RightClickMenu 1 ------------------------------ rightclickWindow = guiCreateStaticImage(0,0,0.05,0.0215,"images/scrollmenu_1.png",true) headline["rightclickmenu"] = guiCreateLabel(0,0,1,1,"",true,rightclickWindow) guiLabelSetHorizontalAlign(headline["rightclickmenu"],"center") guiLabelSetVerticalAlign(headline["rightclickmenu"],"center") guiSetFont(headline["rightclickmenu"],"default-bold-small") guiSetVisible(rightclickWindow,false) function showRightClickInventoryMenu(itemName,itemInfo) if itemInfo then local screenx,screeny,worldx,worldy,worldz = getCursorPosition() guiSetVisible(rightclickWindow,true) guiSetText(headline["rightclickmenu"],itemInfo) local whith = guiLabelGetTextExtent(headline["rightclickmenu"]) guiSetPosition(rightclickWindow,screenx,screeny,true) local x,y = guiGetSize(rightclickWindow,false) guiSetSize(rightclickWindow,whith,y,false) guiBringToFront(rightclickWindow) setElementData(rightclickWindow,"iteminfo",{itemName,itemInfo}) end end function hideRightClickInventoryMenu() guiSetVisible(rightclickWindow,false) guiSetVisible(rightclickWindow2,false) end function hideRightClickInventoryMenu2(button) if button == "left" then hideRightClickInventoryMenu() end end addEventHandler("onClientGUIClick",inv_window,hideRightClickInventoryMenu2,false) addEventHandler("onClientGUIClick",loot_grid,hideRightClickInventoryMenu2,false) addEventHandler("onClientGUIClick",inv_itemsgrid,hideRightClickInventoryMenu2,false) function onPlayerClickOnRightClickMenu(button,state) if button == "left" then local itemName,itemInfo = getElementData(rightclickWindow,"iteminfo")[1],getElementData(rightclickWindow,"iteminfo")[2] hideRightClickInventoryMenu() playerUseItem(itemName,itemInfo) end end addEventHandler("onClientGUIClick",headline["rightclickmenu"],onPlayerClickOnRightClickMenu,false) ------------------------------ RightClickMenu 1 ------------------------------ ------------------------------ RightClickMenu 2 ------------------------------ rightclickWindow2 = guiCreateStaticImage(0,0,0.05,0.0215,"images/scrollmenu_1.png",true) headline["rightclickmenu2"] = guiCreateLabel(0,0,1,1,"",true,rightclickWindow2) guiLabelSetHorizontalAlign(headline["rightclickmenu2"],"center") guiLabelSetVerticalAlign(headline["rightclickmenu2"],"center") guiSetFont(headline["rightclickmenu2"],"default-bold-small") guiSetVisible(rightclickWindow2,false) InfoWindow = guiCreateWindow(382, 323, 268, 155, "Item Info: ", false) guiWindowSetSizable(InfoWindow, false) guiSetVisible(InfoWindow,false) InfoWindowInfo = guiCreateMemo(10, 25, 248, 84, "", false, InfoWindow) guiMemoSetReadOnly(InfoWindowInfo, true) InfoWindowButton = guiCreateButton(10, 119, 248, 26, "Close", false, InfoWindow) guiSetFont(InfoWindowButton, "default-bold-small") guiSetProperty(InfoWindow,"AlwaysOnTop","True") function CloseInfoWindow() guiSetVisible(InfoWindow,false) end addEventHandler("onClientGUIClick",InfoWindowButton,CloseInfoWindow,false) function showRightClickInventoryMenu2(itemName) if itemName then local screenx,screeny,worldx,worldy,worldz = getCursorPosition() guiSetVisible(rightclickWindow2,true) guiSetText(headline["rightclickmenu2"],"Info") local whith = guiLabelGetTextExtent(headline["rightclickmenu2"]) if guiGetVisible(rightclickWindow) then guiSetPosition(rightclickWindow2,screenx,screeny + 0.023,true) else guiSetPosition(rightclickWindow2,screenx,screeny,true) end local x,y = guiGetSize(rightclickWindow2,false) guiSetSize(rightclickWindow2,whith,y,false) guiBringToFront(rightclickWindow2) setElementData(rightclickWindow2,"iteminfo",{itemName,itemInfo}) end end function onPlayerClickOnRightClickMenu2(button,state) if button == "left" then local itemName,itemInfo = getElementData(rightclickWindow2,"iteminfo")[1],getElementData(rightclickWindow2,"iteminfo")[2] hideRightClickInventoryMenu() guiSetText(InfoWindow,"Item Info: "..itemName) guiSetText(InfoWindowInfo,getItemInfo(itemName)) guiSetVisible(InfoWindow,true) x,y = guiGetScreenSize() x2,y2 = guiGetSize(InfoWindow,false) guiSetPosition(InfoWindow,x/2 - x2/2,y/2 - y2/2,false) end end addEventHandler("onClientGUIClick",headline["rightclickmenu2"],onPlayerClickOnRightClickMenu2,false) ------------------------------ RightClickMenu 2 ------------------------------ function playerUseItem(itemName,itemInfo) if itemInfo == "Drink" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Actions/Drink.ogg") triggerServerEvent("onPlayerRequestChangingStats",getLocalPlayer(),itemName,itemInfo,"thirst") refreshNewInventory() elseif itemInfo == "Eat" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Actions/Eat.ogg") triggerServerEvent("onPlayerRequestChangingStats",getLocalPlayer(),itemName,itemInfo,"food") refreshNewInventory() elseif itemInfo == "Open" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) setPedAnimation(getLocalPlayer(),"BOMBER","BOM_Plant",-1,false,false,false,false) triggerServerEvent("onPlayerOpenFood",getLocalPlayer(),itemName) refreshNewInventory() elseif itemInfo == "Use Skin" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Actions/Skin.ogg") triggerServerEvent("onPlayerChangeSkin",getLocalPlayer(),itemName) refreshNewInventory() elseif itemName == "Empty Water Bottle" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerRefillWaterBottle",getLocalPlayer(),itemName) refreshNewInventory() elseif itemInfo == "Set Rate" then guiSetVisible(SetGPSRateWindow,true) elseif itemInfo == "Place Stinger" then setElementData(localPlayer,"Stinger",getElementData(localPlayer,"Stinger")-1) local x, y, z = getElementPosition(localPlayer) local rx, ry, rz = getElementRotation(localPlayer) x = x - math.sin(math.rad(rz))*2 y = y + math.cos(math.rad(rz))*2 rz = rz + 90 local groundZ = getGroundPosition(x,y,z) if(groundZ ~= z) then z = groundZ+0.2 end setPedAnimation(getLocalPlayer(),"BOMBER","BOM_Plant",-1,false,false,false,false) triggerServerEvent("CreateStinger",localPlayer,x,y,z,rz) elseif itemName == "Tent" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Actions/MontarTenda.ogg") triggerServerEvent("onPlayerPitchATent",getLocalPlayer(),itemName) refreshNewInventory() elseif itemInfo == "Colocar Wire Fence" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerBuildAWireFence",getLocalPlayer(),itemName) elseif itemName == "Roadflare" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerPlaceRoadflare",getLocalPlayer(),itemName) refreshNewInventory() elseif itemInfo == "Make a Fire" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerMakeAFire",getLocalPlayer(),itemName) refreshNewInventory() elseif itemInfo == "Usar" then triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) refreshInventory() refreshNewInventory() elseif itemName == "Bandage" then triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) refreshInventory() refreshNewInventory() elseif itemInfo == "Use Googles" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerChangeView",getLocalPlayer(),itemName) elseif itemInfo == "Equip Primary Weapon" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Equip/equip1.wav") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,1) elseif itemInfo == "Equip Secondary Weapon" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Equip/equip2.wav") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,2) elseif itemInfo == "Equip Specially Weapon" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Equip/equip3.wav") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,3) elseif itemInfo == "Equip Pistol" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/Equip/equip3.wav") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,4) elseif itemInfo == "Use Vest" then --if getActiveVest(getLocalPlayer()) and getElementData(getLocalPlayer(),"vestLife") == getVestLife(getActiveVest(getLocalPlayer())) then --setElementData(getLocalPlayer(),getActiveVest(getLocalPlayer()),getElementData(getLocalPlayer(),getActiveVest(getLocalPlayer()))+1) --end for _,vest in pairs(VestsTable)do setElementData(localPlayer,vest[2],false) end for _,vest in pairs(VestsTable)do if vest[1] == itemName then var = vest[2] setElementData(getLocalPlayer(),"vestLife",vest[4]) break end end setElementData(localPlayer,var,true) triggerEvent("refreshInventoryManual",localPlayer) elseif itemInfo == "Use Helmet" then --if getActiveHelmet(getLocalPlayer()) and getElementData(getLocalPlayer(),"helmetLife") == getHelmetLife(getActiveHelmet(getLocalPlayer())) then --setElementData(getLocalPlayer(),getActiveHelmet(getLocalPlayer()),getElementData(getLocalPlayer(),getActiveHelmet(getLocalPlayer()))+1) --end for _,helmet in pairs(HelmetsTable)do setElementData(localPlayer,helmet[2],false) end for _,helmet in pairs(HelmetsTable)do if helmet[1] == itemName then var = helmet[2] setElementData(getLocalPlayer(),"helmetLife",helmet[4]) break end end setElementData(localPlayer,var,true) triggerEvent("refreshInventoryManual",localPlayer) elseif itemInfo == "Wear Backpack" then for _,backpack in pairs(BackpacksTable)do if itemName == backpack[1] then if getElementData(getLocalPlayer(),"MAX_Slots")== backpack[2] then triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Você já usando esta mochila!",255,22,0) elseif getPlayerCurrentSlots() > backpack[2] then triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Your current itens needs to be under "..backpack[2].."!",255,22,0) else setElementData(getLocalPlayer(),"MAX_Slots",backpack[2]) setElementData(getLocalPlayer(),"wearingBackpack",backpack[1]) triggerEvent("refreshInventoryManual",localPlayer) end end end elseif itemInfo == "Remove Backpack" then if getPlayerCurrentSlots() <= 8 then setElementData(getLocalPlayer(),"MAX_Slots",8) setElementData(getLocalPlayer(),"wearingBackpack",false) triggerEvent("refreshInventoryManual",localPlayer) else triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Your current itens needs to be under 8!",255,22,0) end elseif itemInfo == "Remove Vest" then vestSlots = getActiveVestSlots(getLocalPlayer()) if getElementData(getLocalPlayer(),"MAX_Slots")-vestSlots < getPlayerCurrentSlots() then triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Your current itens needs to be under "..getElementData(getLocalPlayer(),"MAX_Slots").."!",255,22,0) return end setElementData(getLocalPlayer(),getActiveVestVar(getLocalPlayer()),false) triggerEvent("refreshInventoryManual",localPlayer) elseif itemInfo == "Remove Helmet" then setElementData(getLocalPlayer(),getActiveHelmetVar(getLocalPlayer()),false) triggerEvent("refreshInventoryManual",localPlayer) end refreshInventory() end function weaponSwitch(ID) for _,item in pairs(weaponTable)do if getElementData(getLocalPlayer(),"currentweapon_1") == item[1] and ID == item[3] and item[5] == 1 then if getElementData(getLocalPlayer(),item[2])> 0 then setElementData(getLocalPlayer(),item[2],getElementData(getLocalPlayer(),item[2])- 1) return end end if getElementData(getLocalPlayer(),"currentweapon_2") == item[1] and ID == item[3] and item[5] == 2 then if getElementData(getLocalPlayer(),item[2])> 0 then setElementData(getLocalPlayer(),item[2],getElementData(getLocalPlayer(),item[2])- 1) end end if getElementData(getLocalPlayer(),"currentweapon_3") == item[1] and ID == item[3] and item[5] == 3 then if getElementData(getLocalPlayer(),item[1])> 0 then setElementData(getLocalPlayer(),item[1],getElementData(getLocalPlayer(),item[1])- 1) end end if getElementData(getLocalPlayer(),"currentweapon_4") == item[1] and ID == item[3] and item[5] == 4 then if getElementData(getLocalPlayer(),item[2])> 0 then setElementData(getLocalPlayer(),item[2],getElementData(getLocalPlayer(),item[2])- 1) end end end end addEventHandler("onClientPlayerWeaponFire",getLocalPlayer(),weaponSwitch) function makeRadioStayOff() setRadioChannel(0) end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff) addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) function getPlayerSackName() local slots = getElementData(localPlayer,"MAX_Slots") if slots then for i, v in ipairs ( sacks ) do if v[2] == slots then return v[1] end end end return false end outputDebugString("inventory loaded") ficarei grato.
  3. pra depurar é so meter um outputDebugString com varias mensagens pra eu saber qual o erro atraves da mensagem que eu coloquei no debugstring ne? vou fazer isso
  4. então mano, praticamente oque falta é so esse bug, o resto consegui resolver a maioria, essa gm adiquiri ano passado, e ja corrigi MUITOS bugs nela, sei onde tem a maioria das funcoes, porem esse bug surgiu recentemente, por iso ainda nao consegui saber oque é, pra mim nao compensa refazer desde o 0, tem MUITA coisa na minha Gm ja, mas o bug q mais atrapalha e oq falta so praticamente é esse :/
  5. Seguinte, a um tempo atras estava com um problema, que eu pensei que fosse do Inventario do MTA DayZ, porém acabei descobrindo que não é, eu troquei o inventário todo, e o bug continuou, percebi que podia ser no script menu_client do mta dayz, porém eu to comparando ele com varios outros menu_client que tenho, e nao tem nada de errado. o erro é o seguinte, o player ta jogando de boa, ai ele vai lotear a tenda dele, e ele clica pra pegar o item, e não vai, o item fica la na tenda, mas simplesmente vc clica pra pegar e nao acontece nada, ai tem que ficar saindo e voltando pra tenda até desbugar, e quando ele consegue acessar, e começa a passar itens pra tenda, no caso seria ao contrario, ao invez de pegar, ele vai guardar, ai dps de um tempo os itens começam ir pro chão, como se ele tivesse saido da tenda, mas na verdade não saiu, e os itens na tenda continuam mostrando no inventario, só que em vez de ir pra tenda, vai pro chão ,creio eu que seja no menu_client, porém ta foda de conseguir saber qual função que seja, alguém poderia me ajudar? (obs: não é só com tenda, com gear de hospitalbox,, gear de corpo de player que no caso é o dead, tbm acontece) ------------S1L3NC3 local theTableMenuScroll = {} function startRollMessageMenu(text, r, g, b, data) table.insert(theTableMenuScroll,{text,r,g,b,data}) end function dxDrawingColorTextMenuScroll(str, ax, ay, bx, by, color, alpha, scale, font, alignX, alignY) if alignX then if alignX == "center" then elseif alignX == "right" then local w = dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font) ax = bx - w end end if alignY then if alignY == "center" then local h = dxGetFontHeight(scale, font) ay = ay + (by-ay)/2 - h/2 elseif alignY == "bottom" then local h = dxGetFontHeight(scale, font) ay = by - h end end local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), alpha) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) ax = ax + w color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), alpha) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font) end end local boxSpace = dxGetFontHeight(1,"default-bold")+dxGetFontHeight(1,"default-bold")*0.1 local optionsTable = { ["player"] = { {"Give Bandage"}, {"Give Painkiller"}, {"Give Morphine"}, }, } function showClientMenuItem(arg1,arg2,arg3,arg4) theTableMenuScroll = {} setElementData(localPlayer,"usedItemTrue", false) numberMenuScroll = 1 if getElementData(localPlayer,"playerZombie") then return end if arg1 == "Take" then startRollMessageMenu("Gear: "..arg2,0,255,0,arg2) setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "stop" then disableMenu() refreshLoot(false) end if arg1 == "Helicrashsite" then startRollMessageMenu("Gear",255,255,255,"helicrashsite") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "AIRDROP" then startRollMessageMenu("Gear",255,255,255,"AIRDROP") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "Hospitalbox" then startRollMessageMenu("Gear",255,255,255,"hospitalbox") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "Vehicle" then startRollMessageMenu("> Gear ("..arg2.."): "..getLootCurrentSlots(arg4).."/"..(getElementData(arg4,"MAX_Slots") or 0).." Slots",0,255,0,"vehicle") setElementData(localPlayer,"usedItemTrue", true) if getElementData(getElementData(arg3,"parent"),"tent") then startRollMessageMenu("#FFFFFF> Remover Tent",0,255,0,"tent") return end if getElementHealth(arg3,"repairvehicle") < 1000 and getElementHealth(arg3) >= 50 then startRollMessageMenu("> Reparar ("..arg2.."): " ..tostring(math.floor(getElementHealth(arg3)/10)).."%",0,255,0,"repairvehicle") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"fuel") or 0) < getVehicleMaxFuel(arg4) then startRollMessageMenu("> Colocar Gasolina ("..tostring(math.floor(getElementData(arg4,"fuel") or 0)).."/"..getVehicleMaxFuel(arg4)..")",255,0,0,"FuelOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"fuel") or 0) >= 20 then startRollMessageMenu("> Remover Gasolina ("..tostring(math.floor(getElementData(arg4,"fuel") or 0)).."/"..getVehicleMaxFuel(arg4)..")",255,255,0,"FuelTwo") setElementData(localPlayer,"usedItemTrue", true) end local tires,engine,parts = getVehicleAddonInfos (getElementModel(arg3)) if (getElementData(arg4,"Tire_inVehicle") or 0) < tires then startRollMessageMenu("> Colocar Tire ("..(getElementData(arg4,"Tire_inVehicle") or 0).."/"..tires..")",255,0,0,"TireOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Engine_inVehicle") or 0) < engine then startRollMessageMenu("> Colocar Engine ("..(getElementData(arg4,"Engine_inVehicle") or 0).."/"..engine..")",255,0,0,"EngineOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Parts_inVehicle") or 0) < parts then startRollMessageMenu("> Colocar Tank Parts ("..(getElementData(arg4,"Parts_inVehicle") or 0).."/"..parts..")",255,0,0,"PartsOne") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"armorPoints") or 0) < (getElementData(arg4,"armorPointsMax") or 0) then if (getElementData(localPlayer,"Steel Sheet") or 0) >= 0 then startRollMessageMenu("> Colocar Steel Sheet",255,0,0,"setListStale") setElementData(localPlayer,"usedItemTrue", true) end end if (getElementData(arg4,"receiver") or 0) < 1 then if getElementData(getLocalPlayer(),"Radio Device") >= 0 then startRollMessageMenu("> Colocar Radio Device",255,0,0,"receiver") setElementData(localPlayer,"usedItemTrue", true) end end if (getElementData(arg4,"Tire_inVehicle") or 0) > 0 then startRollMessageMenu("> Remover Tire ("..(getElementData(arg4,"Tire_inVehicle") or 0).."/"..tires..")",255,255,0,"TireTwo") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Engine_inVehicle") or 0) > 0 then startRollMessageMenu("> Remover Engine ("..(getElementData(arg4,"Engine_inVehicle") or 0).."/"..engine..")",255,255,0,"EngineTwo") setElementData(localPlayer,"usedItemTrue", true) end if (getElementData(arg4,"Parts_inVehicle") or 0) > 0 then startRollMessageMenu("> Remover Tank Parts ("..(getElementData(arg4,"Parts_inVehicle") or 0).."/"..parts..")",255,255,0,"PartsTwo") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Player" then if getElementData(arg2,"bleeding") > 0 and getElementData(getLocalPlayer(),"Bandage") >= 1 then startRollMessageMenu("Give Bandage",255,255,255,"bandage") setElementData(localPlayer,"usedItemTrue", true) end if getElementData(arg2,"blood") < 11900 and getElementData(getLocalPlayer(),"Blood Bag") >= 1 then startRollMessageMenu("Administer Blood Bag",255,255,255,"giveblood") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Dead" then startRollMessageMenu("> Gear ("..arg2..")",0,255,0,"dead") startRollMessageMenu("#FFFFFF> Check Body",0,255,0,"deadreason") setElementData(localPlayer,"usedItemTrue", true) end if arg1 == "Fireplace" then if getElementData(getLocalPlayer(),"#FFFFFF> Raw Meat") >= 1 then startRollMessageMenu("Cook Meat",255,255,255,"fireplace") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "patrol" then if getElementData(getLocalPlayer(),"Empty Gas Canister") >= 1 then startRollMessageMenu("#FFFFFF> Encher (Empty Gas Canister)",255,255,255,"patrolstation") setElementData(localPlayer,"usedItemTrue", true) end end if arg1 == "Wirefence" then startRollMessageMenu("Remove Wire Fence",255,255,255,"wirefence") setElementData(localPlayer, "usedItemTrue", "wirefence") end if arg1 == "Stinger" then startRollMessageMenu("Remove Stinger",255,255,255,"removestinger") setElementData(localPlayer,"usedItemTrue","removestinger") end if arg1 == "Gear" then startRollMessageMenu("> Gear",255,255,255,"itemloot") setElementData(localPlayer,"usedItemTrue", true) end numberMenuScroll = 1 end addEvent("showClientMenuItem",true) addEventHandler("showClientMenuItem",getLocalPlayer(),showClientMenuItem) function PlayerScrollMenuLalitka (key,keyState,arg) if getElementData(localPlayer,"usedItemTrue") then if ( keyState == "down" ) then if arg == "up" then numberMenuScroll = numberMenuScroll-1 if numberMenuScroll < 1 then numberMenuScroll = #theTableMenuScroll end elseif arg == "down" then numberMenuScroll = numberMenuScroll+1 if numberMenuScroll > #theTableMenuScroll then numberMenuScroll = 1 end end end end end bindKey ( "mouse_wheel_up", "down", PlayerScrollMenuLalitka, "up" ) bindKey ( "mouse_wheel_down", "down", PlayerScrollMenuLalitka, "down" ) function disableMenu() theTableMenuScroll = {} setElementData(localPlayer,"usedItemTrue", false) setNewbieInfo (false,"","") end addEvent("disableMenu",true) addEventHandler("disableMenu",getLocalPlayer(),disableMenu) function refreshMenuCar() idd = numberMenuScroll theTableMenuScroll = {} setElementData(localPlayer,"usedItemTrue", false) setNewbieInfo (false,"","") showClientMenuItem("Vehicle",nil,getElementData(getElementData(localPlayer,"currentCol"),"parent"),getElementData(localPlayer,"currentCol")) numberMenuScroll = idd end addEvent("refreshMenuCar",true) addEventHandler("refreshMenuCar",getLocalPlayer(),refreshMenuCar) function getPlayerInCol(tab) for theKey,thePlayer in ipairs(tab) do if thePlayer ~= getLocalPlayer() then return true end end return false end isInFirePlace = false function onPlayerTargetPickup (theElement) if getElementData(getLocalPlayer(),"isDead",true) then return end if theElement == getLocalPlayer() then if getElementData(source,"parent") == getLocalPlayer() then return end local player = getPlayerInCol(getElementsWithinColShape ( source, "player" )) if getPedOccupiedVehicle(getLocalPlayer()) then return end isInFirePlace = false setElementData(getLocalPlayer(),"isInFirePlace",false) if getElementData(source,"player") then showClientMenuItem("Player",getElementData(source,"parent")) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) return end if player then return end if getElementData(source,"tent") then if getElementData(source,"visible") == false then setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) return end end if getElementData(source,"patrolstation") then showClientMenuItem("patrol") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Gear","Need: Empty Gas Canister",source) return end if getElementData(source,"wirefence") then showClientMenuItem("Wirefence") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo(true, "Wirefence","Press '-' or 'middle-mouse' to remove the fence!\nRequired: Toolbox", source) return end if getElementData(source,"stinger") then showClientMenuItem("Stinger") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo(true, "Stinger","Press '-' or 'middle-mouse' to remove the Stinger!\nRequired: Toolbox", source) return end if getElementData(source,"fireplace") then showClientMenuItem("Fireplace") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Fireplace","Need: Raw Meat",source) isInFirePlace = true return end if getElementData(source,"deadman") then showClientMenuItem("Dead",getElementData(source,"playername")) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Search") setNewbieInfo (true,"Gear","Press J To Open Inventory",source) return end if getElementData(source,"item") then showClientMenuItem("Take",getElementData(source,"item")) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",false) setNewbieInfo (true,"Gear","To Choose The Subject!\n"..getElementData(source,"item"),source) return end if getElementData(source,"helicrash") then showClientMenuItem("Helicrashsite","helicrash") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Search") setNewbieInfo (true,"Gear","Press J To Open Inventory",source) return end if getElementData(source,"hospitalbox") then showClientMenuItem("Hospitalbox","hospitalbox") setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Search") setNewbieInfo (true,"Gear","Press J To Open Inventory",source) return end if getElementData(source,"vehicle") and not getElementData(source,"deadVehicle") then if not getElementData(source,"tent") then name = getVehicleName(getElementData(source,"parent")) else name = "Tent" end showClientMenuItem("Vehicle",name,getElementData(source,"parent"),source) setElementData(getLocalPlayer(),"currentCol",source) setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Gear ("..name..")") setNewbieInfo(true, "Gear", "Pressione J para abrir!", source) return end if getElementData(source,"itemloot") then showClientMenuItem("Gear") setElementData(getLocalPlayer(),"loot",true) setElementData(getLocalPlayer(),"lootname","Gear") setElementData(getLocalPlayer(),"currentCol",source) setNewbieInfo (true,"Gear","Press J To Open Inventory",source) return end showClientMenuItem("stop") end end addEventHandler("onClientColShapeHit",getRootElement(),onPlayerTargetPickup) function onPlayerTargetPickup (theElement) if theElement == getLocalPlayer() then showClientMenuItem("stop") setElementData(getLocalPlayer(),"loot",false) setElementData(getLocalPlayer(),"currentCol",false) setElementData(getLocalPlayer(),"near_trader",false) setElementData(getLocalPlayer(),"near_trader_shape",nil ) setNewbieInfo (false,"","") isInFirePlace = false setElementData(getLocalPlayer(),"isInFirePlace",false) if getElementData(source,"smeltery") then setElementData(getLocalPlayer(),"smeltery",false) end end end addEventHandler("onClientColShapeLeave",getRootElement(),onPlayerTargetPickup) local screenWidth, screenHeight = guiGetScreenSize() local newbieShow = false local newbieHead = "-" local newbieText = "-" local newbiePosition = 0,0,0 function setNewbieInfo (show,head,text,element) newbieShow = show newbieHead = head newbieText = text newbiePosition = element end addEventHandler("onClientRender", getRootElement(), function() local veh = getPedOccupiedVehicle (getLocalPlayer()) if veh then disableMenu() else for id, value in pairs(theTableMenuScroll) do if id == numberMenuScroll then r1menu,g1menu,b1menu = 25,153,25 else r1menu,g1menu,b1menu = 19,19,19 end dxDrawRectangle ( 0, 250+id*boxSpace, screenWidth*0.2, boxSpace, tocolor (r1menu,g1menu,b1menu,180) ) dxDrawingColorTextMenuScroll(value[1],6, 250+id*boxSpace, 6, 250+(id+1)*boxSpace, tocolor(value[2],value[3],value[4],170),170, 1, "default-bold", "center", "center") end end if getElementData(getLocalPlayer(),"isDead") == true then return end if newbieShow == false then return end local x,y,z = getElementPosition(newbiePosition) local x,y = getScreenFromWorldPosition (x,y,z) local length = dxGetTextWidth(newbieText, 1, "default-bold") if not x then return end local xx,yy,xx2,yy2 = x-length/2, y-70/2, length+22, 70 if newbieHead == "Item pickup" then dxDrawImage(x-length/2-screenWidth*0.01,y,screenWidth*0.02+length,screenHeight*0.1,"images/Loot1.png",0,0,0,tocolor(255,255,255)) else dxDrawImage(x-length/2-screenWidth*0.01,y,screenWidth*0.02+length,screenHeight*0.1,"images/Loot2.png",0,0,0,tocolor(255,255,255)) end end) function fireRaiseTemperature () if isInFirePlace then if getElementData(getLocalPlayer(),"temperature") <= 38 then setElementData(getLocalPlayer(),"temperature",getElementData(getLocalPlayer(),"temperature")+0.25) end end end setTimer(fireRaiseTemperature,10000,0) unbindKey("mouse3","both") function onPlayerPressMiddleMouse (key,keyState) if ( keyState == "down" ) then if not getElementData(localPlayer,"usedItemTrue") then return end local itemName = getMenuMarkedItem() if itemName == "helicrashsite" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Search" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "itemloot" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Gear" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "wirefence" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Remove Wirefence" triggerServerEvent("removeWirefence",getLocalPlayer(),getElementData(col,"parent")) setPedAnimation(getLocalPlayer(),"BOMBER","BOM_Plant",-1,false,false,false,false) else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "removestinger" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Remove Stinger" triggerServerEvent("RemoveStingerServer",getLocalPlayer(),getElementData(col,"parent")) setPedAnimation(getLocalPlayer(),"BOMBER","BOM_Plant",-1,false,false,false,false) else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "hospitalbox" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Search" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "vehicle" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Search" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "repairvehicle" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then if (getElementData(getLocalPlayer(),"Scrap Metal") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("repairVehicle",getLocalPlayer(),getElementData(col,"parent")) setElementData(getLocalPlayer(),"Scrap Metal",(getElementData(getLocalPlayer(),"Scrap Metal") or 0)-1) -- startRollMessage2("Inventory", "Você reparou o o veículo!", 22, 255, 0 ) --setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Scrap Metal!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "object" then showInventory("j","down") return end if itemName == "receiver" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then if (getElementData(getLocalPlayer(),"Radio Device") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"receiver",1) setElementData(getLocalPlayer(),"Radio Device",(getElementData(getLocalPlayer(),"Radio Device") or 0)-1) startRollMessage2("Inventory", "Você colocou Rádio Device no Veículo!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Radio Device!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "FuelOne" then if (getElementData(getLocalPlayer(),"Full Gas Canister") or 0) >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if getElementData(col,"fuel")+20 < getVehicleMaxFuel(col) then addingfuel = 20 elseif getElementData(col,"fuel")+20 > getVehicleMaxFuel(col)+15 then triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Tanque Cheio!",255,22,0) disableMenu() return else addingfuel = getVehicleMaxFuel(col)-getElementData(col,"fuel") end if (getElementData(col,"Parts_inVehicle") or 0) < 1 then addingfuel = addingfuel/3 triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Resultante do transporte de gasolina!",22,255,0) end setElementData(getLocalPlayer(),"Full Gas Canister",getElementData(getLocalPlayer(),"Full Gas Canister")-1) setElementData(getLocalPlayer(),"Empty Gas Canister",(getElementData(getLocalPlayer(),"Empty Gas Canister") or 0)+1) setElementData(col,"fuel",getElementData(col,"fuel")+addingfuel) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Você encheu "..addingfuel.." L!",22,255,0) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Refuel.mp3") else startRollMessage2("Inventory", "Você não tem Full Gas Canister!", 255, 22, 0 ) end disableMenu() return end if itemName == "FuelTwo" then if (getElementData(getLocalPlayer(),"Empty Gas Canister") or 0) >= 1 then if (getElementData(getLocalPlayer(),"Hose") or 0) >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(getLocalPlayer(),"Full Gas Canister",getElementData(getLocalPlayer(),"Full Gas Canister")+1) setElementData(getLocalPlayer(),"Empty Gas Canister",(getElementData(getLocalPlayer(),"Empty Gas Canister") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) setElementData(col,"fuel",getElementData(col,"fuel")-20) triggerEvent ("displayClientInfo", getLocalPlayer(),"Vehicle","Você retirou 20L do Veículo!",22,255,0) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Refuel.mp3") else startRollMessage2("Inventory", "Você não tem Hose!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Empty Gas Canister!", 255, 22, 0 ) end disableMenu() return end if itemName == "TireOne" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then if (getElementData(getLocalPlayer(),"Tire") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Tire_inVehicle",(getElementData(col,"Tire_inVehicle") or 0)+1) setElementData(getLocalPlayer(),"Tire",(getElementData(getLocalPlayer(),"Tire") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você colocou um Tire!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Tire!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "TireTwo" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if (getElementData(col,"Tire_inVehicle") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Tire_inVehicle",(getElementData(col,"Tire_inVehicle") or 0)-1) setElementData(getLocalPlayer(),"Tire",(getElementData(getLocalPlayer(),"Tire") or 0)+1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você removeu um Tire!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Tire!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "EngineOne" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then if (getElementData(getLocalPlayer(),"Engine") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Engine_inVehicle",(getElementData(col,"Engine_inVehicle") or 0)+1) setElementData(getLocalPlayer(),"Engine",(getElementData(getLocalPlayer(),"Engine") or 0)-1) ---triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você colocu um Engine!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Engine!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end --- steel sheet if itemName == "setListStale" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then if (getElementData(getLocalPlayer(),"Steel Sheet") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"armorPoints",getElementData(col,"armorPoints") + 100) setElementData(getLocalPlayer(),"Steel Sheet",(getElementData(getLocalPlayer(),"Steel Sheet") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você adicionou Steel Sheet!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Steel Sheet!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "EngineTwo" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if (getElementData(col,"Engine_inVehicle") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Engine_inVehicle",(getElementData(col,"Engine_inVehicle") or 0)-1) setElementData(getLocalPlayer(),"Engine",(getElementData(getLocalPlayer(),"Engine") or 0)+1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você removeu um Engine!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Engine!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "PartsOne" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then if (getElementData(getLocalPlayer(),"Tank Parts") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Parts_inVehicle",(getElementData(col,"Parts_inVehicle") or 0)+1) setElementData(getLocalPlayer(),"Tank Parts",(getElementData(getLocalPlayer(),"Tank Parts") or 0)-1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você colocou um Tank Parts!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Tank Parts!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "PartsTwo" then if getElementData(getLocalPlayer(),"Toolbox") >= 1 then local col = getElementData(getLocalPlayer(),"currentCol") if (getElementData(col,"Parts_inVehicle") or 0) > 0 then local col = getElementData(getLocalPlayer(),"currentCol") setElementData(col,"Parts_inVehicle",(getElementData(col,"Parts_inVehicle") or 0)-1) setElementData(getLocalPlayer(),"Tank Parts",(getElementData(getLocalPlayer(),"Tank Parts") or 0)+1) --triggerServerEvent("AnimAddFuel", getLocalPlayer(), getLocalPlayer()) startRollMessage2("Inventory", "Você removeu um Tank Parts!", 22, 255, 0 ) setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) playSound("sounds/Repair.mp3") else startRollMessage2("Inventory", "Você não tem Tank Parts!", 255, 22, 0 ) end else startRollMessage2("Inventory", "Você não tem Toolbox!", 255, 22, 0 ) end disableMenu() return end if itemName == "tent" then local screenW, screenH = guiGetScreenSize() showCursor(true) disableMenu() tentGuiConfirm = guiCreateWindow((screenW - 254) / 2, (screenH - 147) / 2, 254, 147, "Tent", false) guiWindowSetMovable(tentGuiConfirm, false) guiWindowSetSizable(tentGuiConfirm, false) tentLabelConfirm = guiCreateLabel(23, 34, 207, 15, "Deseja realmente remover a tenda?", false, tentGuiConfirm) guiSetFont(tentLabelConfirm, "default-bold-small") tentYesConfirm = guiCreateButton(23, 64, 81, 51, "Remover", false, tentGuiConfirm) tentCancelConfirm = guiCreateButton(149, 64, 81, 51, "Cancelar", false, tentGuiConfirm) addEventHandler("onClientGUIClick",tentYesConfirm, function () local col = getElementData(getLocalPlayer(),"currentCol") showCursor(false) guiSetVisible(tentGuiConfirm, false) triggerServerEvent("removeTent",getLocalPlayer(),getElementData(col,"parent")) setSoundMaxDistance(playSound3D("sounds/DesmontarTenda.mp3",x,y,z),15) end, false) addEventHandler("onClientGUIClick",tentCancelConfirm, function () showCursor(false) guiSetVisible(tentGuiConfirm, false) end, false) return end if itemName == "fireplace" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("addPlayerCookMeat",getLocalPlayer()) disableMenu() return end if itemName == "bandage" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerGiveMedicObject",getLocalPlayer(),itemName,getElementData(col,"parent")) disableMenu() return end if itemName == "giveblood" then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerGiveMedicObject",getLocalPlayer(),itemName,getElementData(col,"parent")) disableMenu() return end if itemName == "dead" then local col = getElementData(getLocalPlayer(),"currentCol") local gearName = "Search" refreshLoot(col,gearName) showInventoryManual() return end if itemName == "deadreason" then local col = getElementData(getLocalPlayer(),"currentCol") outputChatBox(getElementData(col,"deadreason"),244,244,244,true) return end if itemName == "patrolstation" then local col = getElementData(getLocalPlayer(),"currentCol") setPedAnimation (getLocalPlayer(),"BOMBER","BOM_Plant", -1,false,false,false,false) setElementData(getLocalPlayer(),"Empty Gas Canister",getElementData(getLocalPlayer(),"Empty Gas Canister")-1) setTimer ( function() setElementData(getLocalPlayer(),"Full Gas Canister",(getElementData(getLocalPlayer(),"Full Gas Canister") or 0)+1) triggerEvent ("displayClientInfo",getLocalPlayer(),"patrolstation","Você encheu um Empty Gas Canister!",0,255,0) end, 5000, 1 ) playSound("sounds/Refill.mp3") disableMenu() return end if isToolbeltItem(itemName) then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerTakeItemFromGround",getLocalPlayer(),itemName,col) disableMenu() return end if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then local col = getElementData(getLocalPlayer(),"currentCol") triggerServerEvent("onPlayerTakeItemFromGround",getLocalPlayer(),itemName,col) disableMenu() else startRollMessage2("Inventory", "Inventory Full!", 255, 0, 0 ) end end end bindKey ( "mouse3", "down", onPlayerPressMiddleMouse ) bindKey ( "-", "down", onPlayerPressMiddleMouse ) function getMenuMarkedItem() for i,guiItem in ipairs(spalteGuiText) do if getElementData(guiItem,"markedMenuItem") then return getElementData(guiItem,"usedItem") end end end function getMenuMarkedItem() for id, value in pairs(theTableMenuScroll) do if id == numberMenuScroll then return value[5] end end end
  6. sim, é arma duplicada, porém tem varias armas duplicadas, como assault rifles, snipers, e so buga com shotguns
  7. sim já, eu pensei que fosse na função OnPlayerWeaponFire, porém lá ta tudo certo.
  8. boa tarde, seguinte, estou com um problema e não consigo saber oque é, meu servidor de dayz, quando equipo a shotgun, ou sniper (não é toda vez que acontece), mesmo estando com arma e munição, ela não atira, aparece a arma, a munição, ai quando clica pra atirar não acontece nada, ai tem que relogar do servidor, alguem sabe me dizer oque pode ser?
  9. consegui mano, era isso mesmo, obrigadão, e lhe agradeço também pela paciencia que teve comigo kkk, obrigadão !!
  10. pior que nao, se eu removo essa linha, ai que os veiculos ficam realmente 0/0, porem creio que com esta linha esteja errado, porque ela consegue fazer com que alguns veiculos respawnem normalmente com os slots corretos, porem outros continuam respawnando com 0/0
  11. corrigindo **, verdade, confundi com outra coisa, eu juro que ja tinha visto essa table em algum outro lugar, a propria table lembro que tinha visto nao lembro onde, agora fui dar uma pesquisada e realmente nao tem, eu fiquei tipo "ue ???" , mas ela interfere em algo? ou nao muda nada ela estar ali sem existir?
  12. as datas estavam alteradas, fui testando uma por uma e consegui, deu certo cara, obrigado de verdade!!! aproveitando pra nao precisar criar outro tópico, se puder me ajudar tbm, o seguinte, quando spawno os veiculos pela primeira vez pelo svp, ele spawna certingo, dependendo de cada veiculo, com os slots 0/50, entre outros, (o valor 50 varia de cada veículo) e ao respawnar quando explode, ao invez de setar 0/50 novamente, ele spawna 0/0, tentei adicionar um data[5] na linha 34, pois creio que seja nessa data[5] que venha o slots, porém não deu certo, teria como me ajudar também? se possível
  13. boa tarde Bruno, então cara, pra vc isso é facil, mas como eu disse eu sou iniciante, porém em NENHUM momento eu pedi script pronto, eu só perguntei oque eu teria que fazer, eu posto um script e vc me diz que o erro esta nas posicoes, disso eu ja sei, vc que nao leu meu tópico, pois ali mesmo ja da pra saber que o erro esta na posicao, eu so queria instrucao sobre o que eu tenho que fazer no caso, e eu queria pedir um pouco menos de ignorancia, tu ja foi iniciante alguma vez, porém vc deve ter tido mais ajuda do que eu, ou se aprendeu na marra meus parabéns, porém pra mim é difícil, lhe peço compreensão, agora dizer que eu pedi script pronto é mentira, apenas pergunto oque eu tenho que fazer.. enfim, esse codigo que vc me mandou, vc mandou ele pronto, ou tenho que alterar algo? pois se vc mandou ele pronto, não funcionou, ele acusa esse warning, e na hora que o veiculo explode, ao invez de respawnar, da um error no vehicle spawns. https://ibb.co/gWBh9XR https://ibb.co/M101h1J porém eu vou aguardar a resposta pra saber se vc mandou o codigo pronto, ou se tenho que trocar alguma coisa nele. pois é, eu sou iniciante, ainda mais MTA DayZ, é muito complicado, creio que seja mais complicado ainda do que servidores de Roleplay, freeroam, entre outros, e não tem nenhum outro método que posso receber ajuda, porém quando eu pergunto, 'oque eu tenho que fazer?" , o pessoal entende "faz pra mim?" , eu nao pedi script pronto, eu apenas peço ajuda, mas o povo é ignorante pra caramba com iniciantes
  14. bom dia, amigao, sou iniciante eu ja disse, e em nenhum momento eu disse "me entreguem o script pronto por favor", eu só peço ajuda porque eu nao sei oque acontece, eu posto os scripts onde eu acho que seja o problema, se nao quer ajudar é so ignorar o post, simples ué
  15. olá, boa noite, novamente estou aqui, e como ja disse em alguns outros tópicos, sou iniciante, sei que é chato ficar vindo aqui toda hora pedir ajuda em coisas que pra alguns são simples, porém pra alguns outros e eu pode ser complicado. seguinte, estou com meu servidor de dayz com o seguinte erro: o local de spawn de um veiculo é na area 51, fui la peguei o veiculo e guardei em minha base, depois de um tempo, o sistema de backup de veiculos, salva ele na base pra nao perder a localizacao caso de queda do host ou algo do tipo, depois que o carro explode, em vez dele respawnar na 51 que é o seu local de spawn, ele respawna na base, ou seja, ele respawna na onde o backup de veiculos salvou ele, e eu to quebrando a cabeca e nao consigo decifrar, abaixo irei deixar o codigo do spawn de veiculos do server, e tambem do sistema de backup de veiculos. ------------ Sistema de spawn de veiculos do servidor hospitalPacks = { {-2670.87890625,636.8984375,14.453125}, {-2637.0556640625,635.03125,14.453125}, {-1515.669921875,2519.166015625,56.0703125}, {-1513.888671875,2519.5908203125,56.064819335938}, {-1528.8955078125,2516.724609375,55.986171722412}, {2022.1650390625,-1402.6806640625,17.18045425415}, {2042.7001953125,-1409.4775390625,17.1640625}, {1171.490234375,-1310.560546875,13.986573219299}, {1171.609375,-1306.556640625,13.996350288391}, {1158.5048828125,-1326.333984375,31.503561019897}, {1159.80078125,-1323.9013671875,31.498970031738}, {1238.7119140625,328.2431640625,19.7555103302}, {1229.365234375,311.1435546875,24.7578125}, {-2204.07421875,-2309.58203125,31.375}, {1615.939453125,1818.0537109375,10.8203125}, {1601.9443359375,1816.736328125,10.8203125}, {1590.0166015625,1792.0234375,30.46875}, {1607.3232421875,1776.7412109375,37.3125}, {2107.7626953125,926.16015625,10.8203125}, {2116.12890625,925.7705078125,10.9609375}, {2122.1865234375,925.3193359375,10.8203125}, {275.30685424805,1889.0017089844,17.671506881714}, ----- Tenda Medica 51 ------- {275.29724121094,1894.240234375,17.669857025146}, ----- Tenda Medica 51 ------- {246.54913330078,2114.4567871094,17.671398162842}, ----- Tenda Medica 51 ------- {240.98666381836,2114.3959960938,17.670330047607}, ----- Tenda Medica 51 ------- {1389.0604248047,1772.0107421875,10.868975639343}, ----- Tenda Medica Aero LV ------ {-2667.3984375,612.50695800781,14.570329666138}, ------- Tenda Medica HP SF ------- {-2662.3532714844,612.74169921875,14.572191238403}, ------- Tenda Medica HP SF -------- {1612.0623779297,1848.4633789063,10.870816230774}, -------- Tenda Medica HP LV -------- {1605.9671630859,1848.6759033203,10.878125190735}, -------- Tenda Medica HP LV -------- {-1247.9757080078,22.812610626221,14.171301841736}, ------- Tenda Medica Aero SF ------- {-296.43521118164,1084.3815917969,19.771415710449}, ------- Tenda Medica HP FC ----------- {-300.16088867188,1047.8997802734,20.170841217041}, ------- HP FC -------- {-315.2180480957,1046.5977783203,20.207050323486}, -------- HP FC -------- {-325.88632202148,1048.3531494141,20.199048995972}, ------- HP FC -------- {-332.0661315918,1050.5997314453,20.18150138855}, --------- HP FC -------- } patrolPoints = { {-1603.2197265625,-2712.736328125,48.9453125}, {2465.748046875,-2215.55859375,13.546875}, {2473.439453125,-2215.56640625,13.546875}, {2480.0732421875,-2216.140625,13.546875}, {2487.24609375,-2215.5966796875,13.546875}, {2494.1005859375,-2215.5859375,13.546875}, {-1686.6728515625,408.9970703125,7.3984375}, {-1682.34375,412.9384765625,7.3984375}, {-1680.0263671875,402.3642578125,7.3984375}, {-1675.84375,406.4677734375,7.3984375}, {-1670.5615234375,411.8359375,7.3984375}, {-1666.2392578125,416.2509765625,7.3984375}, {-1672.7939453125,422.81640625,7.3984375}, {-1677.20703125,418.46484375,7.3984375}, {-2410.7021484375,969.9091796875,45.4609375}, {-2410.744140625,975.220703125,45.4609375}, {-2410.837890625,980.5302734375,45.4609375}, {-1329.3046875,2668.5126953125,50.46875}, {-1328.7314453125,2673.90625,50.0625}, {-1327.0185546875,2679.3876953125,50.46875}, {-1327.3798828125,2684.62890625,50.0625}, {1940.7099609375,-1778.5244140625,13.390598297119}, {1940.6552734375,-1774.908203125,13.390598297119}, {1940.630859375,-1771.728515625,13.390598297119}, {1940.7080078125,-1767.3837890625,13.390598297119}, {-1477.921875,1868.138671875,32.639846801758}, {-1466.1552734375,1869.0048828125,32.6328125}, {-1464.5224609375,1861.3828125,32.639846801758}, {-1477.4599609375,1860.5205078125,32.6328125}, {-735.9208984375,2744.0087890625,47.2265625}, {-739.0439453125,2744.2421875,47.165451049805}, {377.6953125,2601.1083984375,16.484375}, {624.5263671875,1676.25390625,6.9921875}, {620.2958984375,1681.2431640625,6.9921875}, {616.248046875,1686.4169921875,7.1875}, {612.783203125,1691.1650390625,7.1875}, {609.2060546875,1696.201171875,7.1875}, {605.8505859375,1700.978515625,7.1875}, {602.27734375,1706.3603515625,7.1875}, {2141.037109375,2742.734375,10.960174560547}, {2142.3115234375,2752.6982421875,10.96019744873}, {2147.9521484375,2752.3203125,10.8203125}, {2152.60546875,2751.953125,10.8203125}, {2152.984375,2743.85546875,10.8203125}, {2147.75,2743.7392578125,10.8203125}, {-97.6298828125,-1175.0283203125,2.4990689754486}, {-90.74609375,-1177.853515625,2.2021217346191}, {-84.75390625,-1163.853515625,2.3359375}, {-91.5771484375,-1160.5732421875,2.4453125}, {-1606.525390625,-2717.2138671875,48.9453125}, {-1609.7109375,-2721.544921875,48.9453125}, {-1599.83203125,-2708.302734375,48.9453125}, {-2246.314453125,-2558.8212890625,32.0703125}, {-2241.3125,-2561.3662109375,32.0703125}, {-1132.2880859375,-135.0986328125,14.14396572113}, {-1153.529296875,-156.373046875,14.1484375}, {-1142.826171875,-145.67578125,14.14396572113}, {655.611328125,-557.9912109375,16.501491546631}, {655.6572265625,-572.1728515625,16.501491546631}, {1601.791015625,2203.90625,11.060997009277}, {1596.806640625,2203.4345703125,10.8203125}, {1590.197265625,2203.4853515625,10.8203125}, {1589.4775390625,2195.43359375,10.8203125}, {1596.125,2194.294921875,10.8203125}, {1601.6591796875,2194.3369140625,10.8203125}, {2206.8466796875,2470.47265625,10.8203125}, {2206.94140625,2474.75,10.8203125}, {2206.9267578125,2478.86328125,10.8203125}, {2198.06640625,2480.6953125,10.8203125}, {2197.541015625,2475.791015625,10.995170593262}, {2197.609375,2471.9169921875,10.995170593262}, {2120.8251953125,915.4833984375,10.8203125}, {2115.1181640625,915.44140625,10.8203125}, {2109.076171875,915.4228515625,10.8203125}, {2109.22265625,924.8779296875,10.9609375}, {2114.9404296875,924.8857421875,10.9609375}, {2119.5126953125,925.2861328125,10.9609375}, {2645.7197265625,1112.7802734375,10.8203125}, {2639.984375,1112.56640625,10.8203125}, {2634.828125,1112.3466796875,10.9609375}, {2634.1826171875,1101.9482421875,10.8203125}, {2636.7509765625,1101.6748046875,10.8203125}, {2643.5126953125,1101.81640625,10.8203125}, {2209.576171875,2469.8251953125,10.8203125}, {2208.8310546875,2475.09375,10.8203125}, {1005.078125,-901.7490234375,42.216625213623}, {993.025390625,-902.474609375,42.222496032715}, } lootItems = { helicrashsides = { {"Compass",1851,1,0,2}, {"Scrap Metal",1577,1,0,3}, {"Stinger",2899,0.3,0,3}, {"Tire Repair Kit",2015,0.5,0,4}, {"Hose",1880,0.5,0,6}, {"Syringe",2000,1,0,6}, {"Night Vision Goggles",368,1,90,10}, {"Box of Matches",328,0.4,90,2}, {"Hunting Knife",335,1,90,4}, {"Chainsaw",341,1,90,4}, {"Hatchet",339,1,90,3}, {"Pizza",1582,1,0,2}, {"Soda Bottle",2647,1,0,2}, {"Empty Gas Canister",1650,1,0,2}, {"Roadflare",324,1,90,2}, {"Grenade",342,1,0,2}, {"Parachute",342,1,0,2}, {"Watch",2710,1,0,4}, {"Crossbow",357,1,90,6}, {"Night Vision Goggles",368,1,90,1.5}, {"Tire",1073,1,0,2}, {"GPS",2976,0.15,0,3}, {"Map",1277,0.8,90,7}, {"Toolbox",2969,0.5,0,1}, {"Engine",929,0.3,0,2}, {"Main Rotor Assembly",929,0.3,0,2}, {"Tent",1279,1,0,3.5}, {"Infrared Goggles",369,1,90,3}, }, hospital = { {"Syringe",2000,1,0}, {"Antibiotics",1919,2.1,0}, {"Medic Kit",2891,0.7,0}, {"Heat Pack",1576,1,0}, {"Bandage",1578,0.5,0}, {"Blood Bag",1580,1,0}, {"Morphine",1579,1,0}, {"Blood Bag",1580,1,0}, {"Medic Kit",2891,0.7,0}, {"Blood Bag",1580,1,0}, {"Painkiller",1580,1,0} } } for i,bpData in pairs(BackpacksTable)do table.insert(lootItems.helicrashsides,{bpData[1],bpData[3],1,0,bpData[4][5]}) end function updateHospitals() for i,box in pairs(hospitalCol)do for _,items in ipairs(lootItems.hospital)do setElementData(hospitalCol[i],items[1],math.random(1,5)) end end setTimer(updateHospitals,3600000,1) end hospitalCol = {} function createHospitalPacks() number1 = 0 for i,box in ipairs(hospitalPacks)do number1 = number1 + 1 local x,y,z = box[1],box[2],box[3] object = createObject(1558,x,y,z) setObjectScale(object,1) hospitalCol[i] = createColSphere(x,y,z,2) setElementData(hospitalCol[i],"parent",object) setElementData(hospitalCol[i],"hospitalbox",true) setElementData(hospitalCol[i],"MAX_Slots",20) for _,items in ipairs(lootItems.hospital)do local randomNumber = math.random(1,10) if randomNumber >= 5 then setElementData(hospitalCol[i],items[1],math.random(1,5)) end end end setTimer(updateHospitals,3600000,1) end createHospitalPacks() patrolCol = {} for num,patrol in ipairs(patrolPoints) do local x,y,z = patrol[1],patrol[2],patrol[3] patrolCol[num] = createColSphere(x,y,z,3) setElementData(patrolCol[num],"patrolstation",true) local rand = math.random(1,15) if rand == 1 then lts = 100 elseif rand == 2 or rand == 3 then lts = 80 elseif rand >= 4 or rand <= 6 then lts = 60 elseif rand >= 7 or rand <= 10 then lts = 40 else lts = 20 end setElementData(patrolCol[num],"patrollts",lts) end function updatepatrol() for i,box in pairs(patrolCol) do local rand = math.random(1,15) if rand == 1 then lts = 100 elseif rand == 2 or rand == 3 then lts = 80 elseif rand >= 4 or rand <= 6 then lts = 60 elseif rand >= 7 or rand <= 10 then lts = 40 else lts = 20 end setElementData(patrolCol[i],"patrollts",lts) end end setTimer(updatepatrol,10800000,0) function spawnDayZVehicles() for _, data in ipairs(vehicleSpawns) do veh = createVehicle(data[1],data[2],data[3],data[4]) vehCol = createColSphere(data[2],data[3],data[4],2.5) attachElements(vehCol,veh,0,0,0) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) local tires,engine,parts = getVehicleAddonInfos(getElementModel(veh)) setElementData(vehCol,"Tire_inVehicle",math.random(0,tires)) setElementData(vehCol,"Engine_inVehicle",math.random(0,engine)) setElementData(vehCol,"Parts_inVehicle",math.random(0,parts)) setElementData(vehCol,"Tire_inVehicle_HP",400) setElementData(vehCol,"Engine_inVehicle_HP",400) setElementData(vehCol,"Parts_inVehicle_HP",400) setElementData(vehCol,"armorPointsMax",data[6]) setElementData(vehCol,"armorPoints",0) setElementData(vehCol,"vehicle:station",0) setElementData(vehCol,"receiver",0) setVehicleHeadLightColor(veh,math.random(0,255),math.random(0,255),math.random(0,255)) setElementData(vehCol,"fuel",10) setElementData(vehCol,"MAX_Slots",data[5]) setElementData(vehCol,"spawn",{data[1],data[2],data[3],data[4]}) end end function spawnVehiclePack(ps,cmd) if getElementData(ps,"admin") then spawnDayZVehicles() outputChatBox("SVP Sucess!",ps,8, 193, 207,true) end end addCommandHandler("svp",spawnVehiclePack) function notifyAboutExplosion() occupants = getVehicleOccupants(source) or {} for _,peds in pairs(occupants)do removePedFromVehicle(peds) end local col = getElementData(source,"parent") -- if col and getElementData(col,"helicrash") then return end id,x,y,z = getElementData(col,"spawn")[1],getElementData(col,"spawn")[2],getElementData(col,"spawn")[3],getElementData(col,"spawn")[4] setTimer(respawnDayZVehicle,1800000,1,id,x,y,z,source,col,getElementData(col,"MAX_Slots")) setElementData(col,"deadVehicle",true) setElementData(source,"isExploded",true) x1,y1,z1 = getElementPosition(source) createExplosion(x1+1,y1+1,z1,4) createExplosion(x1-1,y1-1,z1,4) createExplosion(x1+1,y1-1,z1,4) createExplosion(x1-1,y1+1,z1,4) end addEventHandler("onVehicleExplode",getRootElement(),notifyAboutExplosion) function respawnVehiclesInWater(vehiclesInWater) for i,veh in ipairs(getElementsByType("vehicle"))do if isElementInWater(veh) and getVehicleType(veh) ~= "Boat" then local col = getElementData(veh,"parent") id,x,y,z = getElementData(col,"spawn")[1],getElementData(col,"spawn")[2],getElementData(col,"spawn")[3],getElementData(col,"spawn")[4] respawnDayZVehicle(id,x,y,z,veh,col) end end end setTimer(respawnVehiclesInWater,1800000,0) function respawnDayZVehicle(id,x,y,z,veh,col,max_slots) local armorMax = getElementData(col,"armorPointsMax") destroyElement(veh) destroyElement(col) veh = createVehicle(id,x,y,z+1) vehCol = createColSphere(x,y,z,4) attachElements ( vehCol, veh, 0, 0, 0 ) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"MAX_Slots",max_slots) --Engine + Tires local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) setElementData(vehCol,"Tire_inVehicle",math.random(0,tires)) setElementData(vehCol,"Engine_inVehicle",math.random(0,engine)) setElementData(vehCol,"Parts_inVehicle",math.random(0,parts)) setElementData(vehCol,"Tire_inVehicle_HP",400) setElementData(vehCol,"Engine_inVehicle_HP",400) setElementData(vehCol,"Parts_inVehicle_HP",400) setElementData(vehCol,"armorPointsMax",armorMax) setElementData(vehCol,"armorPoints",0) setVehicleHeadLightColor(veh,math.random(0,255),math.random(0,255),math.random(0,255)) setElementData(vehCol,"receiver",0) setElementData(vehCol,"vehicle:station",0) --vehicle_indentifikation setElementData(vehCol,"spawn",{id,x,y,z}) --others setElementData(vehCol,"fuel",10) end function onPlayerEnterDayzVehicle(veh,seat) local col = getElementData(veh,"parent") local id = getElementModel(veh) local tires,engine,parts = getVehicleAddonInfos (id) setElementData(veh,"maxfuel",getVehicleMaxFuel(col)) setElementData(veh,"needtires",tires) setElementData(veh,"needengine",engine) setElementData(veh,"needparts",parts) if ((getElementData(col,"Tire_inVehicle") or 0) < tonumber(tires)) then setVehicleEngineState(veh,false) return end if ((getElementData(col,"Engine_inVehicle") or 0) < tonumber(engine)) then setVehicleEngineState(veh,false) return end if ((getElementData(col,"Parts_inVehicle") or 0) < tonumber(parts)) then setVehicleEngineState(veh,false) return end if (getElementData(col,"fuel") or 0) <= 1 then if not getElementModel(veh) == 510 then setVehicleEngineState(veh,false) return end end end addEventHandler("onPlayerVehicleEnter",getRootElement(),onPlayerEnterDayzVehicle) function setEngineState(player,key,keyState) local theVehicle = getPedOccupiedVehicle(player) if theVehicle and getVehicleController(theVehicle) == player then if checkVehicleMovable(theVehicle) then setVehicleEngineState(theVehicle, not getVehicleEngineState(theVehicle)) end end end function checkVehicleMovable(veh) if isElement(veh) then local parent = getElementData(veh,"parent") if parent then if ((getElementData(parent,"Tire_inVehicle") or 0) ~= getElementData(veh,"needtires")) then setVehicleEngineState(veh,false) return false end if ((getElementData(parent,"Engine_inVehicle") or 0) ~= getElementData(veh,"needengine")) then setVehicleEngineState(veh,false) return false end if ((getElementData(parent,"Parts_inVehicle") or 0) ~= getElementData(veh,"needparts")) then setVehicleEngineState (veh,false) return false end return true end end end function onPlayerExitDayzVehicle(veh,seat) if seat == 0 then setVehicleEngineState (veh,false) end unbindKey(source,"k","down",setEngineState) end addEventHandler("onPlayerVehicleExit",getRootElement(),onPlayerExitDayzVehicle) function setVehiclesFuelPerMinute () for i,veh in ipairs(getElementsByType("vehicle")) do if getVehicleEngineState(veh) == true then if getElementData(getElementData(veh,"parent"),"fuel") >= 0 then setElementData(getElementData(veh,"parent"),"fuel",getElementData(getElementData(veh,"parent"),"fuel")-getVehicleFuelRemove(getElementModel(veh),getElementData(veh,"parent"))) else setVehicleEngineState ( veh, false ) end end end end setTimer(setVehiclesFuelPerMinute,20000,0) function isVehicleReadyToStart2 (veh) if getElementData(getElementData(veh,"parent"),"fuel") >= 1 then local tires,engine,parts,metal = getVehicleAddonInfos (getElementModel(veh)) if (getElementData(getElementData(veh,"parent"),"Tire_inVehicle") or 0) > tonumber(tires) and (getElementData(getElementData(veh,"parent"),"Engine_inVehicle") or 0) > tonumber(engine) and (getElementData(getElementData(veh,"parent"),"Parts_inVehicle") or 0) > tonumber(parts) then setVehicleEngineState ( veh, true ) end end setTimer(isVehicleReadyToStart2,1000,1,veh) end repairTimer = {} function repairVehicle (veh) if repairTimer[veh] then triggerClientEvent (source, "displayClientInfo", source,"Vehicle"," is currently being repaired!",255,22,0) return end local health = math.floor(getElementHealth(veh)) repairTimer[veh] = setTimer(fixVehicleDayZ, 25000, 1, veh, source) setElementFrozen (veh,true) setElementData(veh,"repairer",source) setElementData(source,"repairingvehicle",veh) setPedAnimation (source,"SCRATCHING","sclng_r",nil,false,false) triggerClientEvent (source, "displayClientInfo", source,"Vehicle","Você começou a reparar o veículo, aguarde...",255,0,0) end addEvent("repairVehicle",true) addEventHandler("repairVehicle",getRootElement(),repairVehicle) function fixVehicleDayZ(veh,player) setElementHealth(veh,1000) fixVehicle (veh) setPedAnimation(player,false) setElementFrozen (veh,false) setVehicleDamageProof (veh,false) repairTimer[veh] = nil setElementData(veh,"repairer",nil) setElementData(player,"repairingvehicle",nil) triggerClientEvent (player, "displayClientInfo", player,"Vehicle","Você terminou de reparar o veículo.",22,255,0) end function stopFixxingWhileMoving() local veh = getElementData(source,"repairingvehicle") setPedAnimation(source) setElementFrozen (veh,false) setVehicleDamageProof (veh,false) setElementData(veh,"repairer",nil) setElementData(source,"repairingvehicle",nil) setElementData(source,"Repairing",false) triggerClientEvent (source, "displayClientInfo", source,"Vehicle","Você parou de reparar o veículo.",22,255,0) killTimer(repairTimer[veh]) repairTimer[veh] = nil end addEvent("onClientMovesWhileAnimation",true) addEventHandler("onClientMovesWhileAnimation",getRootElement(),stopFixxingWhileMoving) function debugFixxing() for i,veh in ipairs(getElementsByType("vehicle")) do if getElementData(veh,"repairer") == source then setVehicleDamageProof (veh,false) outputDebugString("Vehicle repairer disconnected - destroyed tables") killTimer(repairTimer[veh]) setElementFrozen (veh,false) repairTimer[veh] = nil setElementData(veh,"repairer",nil) end end end addEventHandler("onPlayerQuit",getRootElement(),debugFixxing) --------- sistema de backup dos veiculos needToSave = { {"MAX_Slots"}, {"Tire_inVehicle"}, {"Engine_inVehicle"}, {"Parts_inVehicle"}, {"Tire_inVehicle_HP"}, {"Engine_inVehicle_HP"}, {"Parts_inVehicle_HP"}, {"armorPointsMax"}, {"armorPoints"}, {"fuel"}, {"maxfuel"}, {"needengine"}, {"needtires"}, {"needparts"}, {"receiver"}, } function SaveVehicles(player) if isElement(player) then if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then return end end fileDelete("SaveSystem/XVehicles.xml") xml = xmlCreateFile("SaveSystem/XVehicles.xml","config") xmlSaveFile(xml) count = 0 for _,vehCol in pairs(getElementsByType("colshape")) do if getElementData(vehCol,"vehicle") and not getElementData(vehCol,"tent") then count = count + 1 if getElementData(vehCol,"parent") and isElement(getElementData(vehCol,"parent")) then veh = getElementData(vehCol,"parent") slots = getElementData(vehCol,"MAX_Slots") health = getElementHealth(veh) x,y,z = getElementPosition(veh) rx,ry,rz = getElementRotation(veh) VehInfos = xmlCreateChild(xml,"Veh") xmlNodeSetAttribute(VehInfos,"Name",getVehicleName(veh)) xmlNodeSetAttribute(VehInfos,"ID",getElementModel(veh)) xmlNodeSetAttribute(VehInfos,"Health",math.floor(health)) xmlNodeSetAttribute(VehInfos,"X",x) xmlNodeSetAttribute(VehInfos,"Y",y) xmlNodeSetAttribute(VehInfos,"Z",z) xmlNodeSetAttribute(VehInfos,"RX",rx) xmlNodeSetAttribute(VehInfos,"RY",ry) xmlNodeSetAttribute(VehInfos,"RZ",rz) VehItens = xmlCreateChild(VehInfos,"Itens") for _,item in pairs(vehicleDataTable)do if(tonumber(getElementData(vehCol,item[1])) and getElementData(vehCol,item[1]) >= 1) then Item2 = xmlCreateChild(VehItens,"Item") xmlNodeSetAttribute(Item2,"Item",item[1]) xmlNodeSetAttribute(Item2,"Quant",getElementData(vehCol,item[1]) or 0) end end for _,item in pairs(needToSave)do Item2 = xmlCreateChild(VehItens,"Item") xmlNodeSetAttribute(Item2,"Item",item[1]) xmlNodeSetAttribute(Item2,"Quant",getElementData(vehCol,item[1]) or 0) end end end end xmlSaveFile(xml) xmlUnloadFile(xml) if isElement(player) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then outputChatBox("#FFFFFFQuantidade de Veículos Salvos #FF0000*#FFFFFF"..count.."#FF0000*",player,255,0,0,true) end end end addEventHandler("onResourceStop",getResourceRootElement(),SaveVehicles) setTimer(SaveVehicles,10000,0) function LoadVehicles(player) if isElement(player) then if not isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then return end end xml = xmlLoadFile("SaveSystem/XVehicles.xml") for i,node in pairs(xmlNodeGetChildren(xml)) do x = tonumber(xmlNodeGetAttribute(node,"X")) y = tonumber(xmlNodeGetAttribute(node,"Y")) z = tonumber(xmlNodeGetAttribute(node,"Z")) rx = tonumber(xmlNodeGetAttribute(node,"RX")) ry = tonumber(xmlNodeGetAttribute(node,"RY")) rz = tonumber(xmlNodeGetAttribute(node,"RZ")) veh = createVehicle(tonumber(xmlNodeGetAttribute(node,"ID")),x,y,z,rx,ry,rz) vehCol = createColSphere(x,y,z,4) setElementData(vehCol,"spawn",{tonumber(xmlNodeGetAttribute(node,"ID")),x,y,z}) attachElements(vehCol,veh,0,0,0) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementHealth(veh,tonumber(math.floor(xmlNodeGetAttribute(node,"Health")))) for i,Item in pairs(xmlNodeGetChildren(xmlFindChild(node,"Itens",0))) do setElementData(vehCol,xmlNodeGetAttribute(Item,"Item"),tonumber(xmlNodeGetAttribute(Item,"Quant"))) end end xmlUnloadFile(xml) if isElement(player) then if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(player)),aclGetGroup("Admin"))then outputChatBox("Todos os Veículos foram salvos com sucesso",player,255,0,0,true) end end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),LoadVehicles) addCommandHandler("savevehs",SaveVehicles) addCommandHandler("loadvehs",LoadVehicles)
  16. e como eu faço isso? ja tentei varias maneiras e n consegui
  17. sim mas eu teria que adicionar um true na linha 348 ou 349? ou trocar o numbers por um numero, eu n entendi
  18. mas ja tem um numero ali, vc diz que o proprio "number" teria que ser um numero? ou eu teria que adicionar um true nele?
  19. boa noite, tenho um servidor de mta dayz, e como todos conhecem tem o famoso inventario, porém tem a funcao de pegar item do chao, e a funcao de dropar tudo de uma vez, e a funcao de dropar tudo de uma vez buga quando vou dropar em tendas, quando dropo no chão, vai normal, mas quando dropo tudo de uma vez em tenda, da esse erro abaixo e nao dropa ERROR: [DayZ-MTA]\DayZ\Client\Inventario.lua:349 "for" limit must be a number -----------S1L3NC3 inventoryItems = { ["Primary Weapon"] = {}, ["Secondary Weapon"] = {}, ["Specially Weapon"] = {}, ["Ammo"] = {}, ["Food"] = { {"Canned Spaghetti (Fechado)",1}, {"Canned Spaghetti (Aberto)",1}, {"Canned Baked Beans (Fechado)",1}, {"Canned Baked Beans (Aberto)",1}, {"Canned Sardines (Fechado)",1}, {"Canned Sardines (Aberto)",1}, {"Can of Tactical Bacon (Fechado)",1}, {"Can of Tactical Bacon (Aberto)",1}, {"Water Bottle",1}, {"Burger",1}, {"Pizza",1}, {"Soda Bottle",1}, {"Milk",1}, {"Cooked Meat",1}, {"Raw Meat",1}, }, ["Medic"] = { {"Antibiotics",1,"Usar"}, {"Bandage",1,"Usar"}, {"Medic Kit",2,"Usar"}, {"Heat Pack",1,"Usar"}, {"Painkiller",1,"Usar"}, {"Blood Bag",1,"Usar"}, {"Morphine",1,"Usar"}, }, ["VehicleParts"] = { {"Engine",5}, {"Tire",2}, {"Tank Parts",3}, {"Scrap Metal",1}, {"Steel Sheet",1}, {"Empty Gas Canister",2}, {"Full Gas Canister",2}, }, ["Items"] = { {"Stinger",3,"Place Stinger"}, {"Wood Pile",2}, {"Roadflare",1,"Place"}, {"Wire Fence",1,"Colocar Wire Fence"}, {"Tent",3,"Pitch a Tent"}, {"Empty Water Bottle",1}, {"Empty Soda Cans",1}, }, ["Roupas"] = { }, ["Mochilas"] = { }, ["Toolbelt"] = { {"Night Vision Goggles",0}, {"Infrared Goggles",0}, {"Map",0}, {"Box of Matches",0,"Make a Fire"}, {"Watch",0}, {"GPS",0,"Set wave"}, {"Toolbox",0}, {"Radio Device",0}, {"Syringe",0}, {"Opener",0}, {"Hose",0}, {"Tire Repair Kit",0}, {"Compass",0}, }} for i,weaponData in pairs(weaponTable)do if weaponData[5] == 1 then table.insert(inventoryItems["Primary Weapon"],{weaponData[1],3,weaponData[2],2,weaponData[11]}) elseif weaponData[5] == 2 then if weaponData[2] == "others" then table.insert(inventoryItems["Secondary Weapon"],{weaponData[1],2,weaponData[1],2,weaponData[11]}) else table.insert(inventoryItems["Secondary Weapon"],{weaponData[1],2,weaponData[2],2,weaponData[11]}) end elseif weaponData[5] == 3 then table.insert(inventoryItems["Specially Weapon"],{weaponData[1],1,weaponData[1],1,weaponData[11]}) end if weaponData[2] ~= "others" then add = true for i,weaponData2 in pairs(inventoryItems["Ammo"])do if weaponData[2] == weaponData2[1] then add = false inventoryItems["Ammo"][i][5] = inventoryItems["Ammo"][i][5]..";\n"..weaponData[1] end end if add then table.insert(inventoryItems["Ammo"],{weaponData[2],weaponData[8],"",1,"Munição para:\n"..weaponData[1]}) end end end for i,vestData in pairs(VestsTable)do table.insert(inventoryItems["Roupas"],{vestData[1],1,"Usar Colete",1,vestData[7]}) end for i,helmetData in pairs(HelmetsTable)do table.insert(inventoryItems["Roupas"],{helmetData[1],1,"Usar Capacete",1,helmetData[7]}) end for i,bpData in pairs(BackpacksTable)do table.insert(inventoryItems["Mochilas"],{bpData[1],1,"Vestir Mochila",1,"Mochila com "..bpData[2].." Slots"}) end ------------------------------------------------------------------------------ --INVENTORY local headline = {} local fontnamesv = guiCreateFont("font.ttf", 50) pname = getPlayerName(getLocalPlayer()):gsub('#%x%x%x%x%x%x',''):gsub('#%x%x%x%x%x%x','') inv_window = guiCreateWindow(0.15, 0.28, 0.72, 0.63,pname.."' Inventory", true) guiWindowSetSizable(inv_window, false) guiSetVisible(inv_window,false) InvImage = guiCreateStaticImage(0.01,0.03,1.99,100,"images/inventory.png",true,inv_window) guiSetAlpha(InvImage,1) guiSetProperty(InvImage,"Disabled","true") InventoryLabel = guiCreateLabel(0.58, 0.05, 0.39, 0.03, "Inventory", true, inv_window) guiSetFont(InventoryLabel, "default-bold-small") guiLabelSetHorizontalAlign(InventoryLabel, "center", false) LootLabel = guiCreateLabel(0.03, 0.05, 0.39, 0.03, "Gear", true, inv_window) guiSetFont(LootLabel, "default-bold-small") guiLabelSetHorizontalAlign(LootLabel, "center", false) loot_grid = guiCreateGridList(0.03, 0.10, 0.39, 0.83, true, inv_window) guiGridListSetSortingEnabled(loot_grid,false) loot_lootcolumn = guiGridListAddColumn(loot_grid,"Loot",0.7) loot_amountcolumn = guiGridListAddColumn(loot_grid,"Amount",0.2) inv_itemsgrid = guiCreateGridList(0.58, 0.11, 0.39, 0.83, true, inv_window) guiGridListSetSortingEnabled(inv_itemsgrid,false) inv_itemscolumn = guiGridListAddColumn(inv_itemsgrid,"Inventory",0.7) inv_amountcolumn = guiGridListAddColumn(inv_itemsgrid,"Amount",0.2) loot_takebutton = guiCreateButton(0.42, 0.19, 0.04, 0.63, "->", true, inv_window) guiSetFont(loot_takebutton, "default-bold-small") inv_dropbutton = guiCreateButton(0.54, 0.19, 0.04, 0.63, "<-", true, inv_window) guiSetFont(inv_dropbutton, "default-bold-small") inv_slotslabel = guiCreateLabel(0.62, 0.94, 0.29, 0.04, "Slots:", true, inv_window) guiSetFont(inv_slotslabel, "default-bold-small") guiLabelSetHorizontalAlign(inv_slotslabel, "center", false) guiLabelSetVerticalAlign(inv_slotslabel, "center") loot_amountlabel = guiCreateLabel(0.07, 0.94, 0.29, 0.04, "Empty", true, inv_window) guiSetFont(loot_amountlabel, "default-bold-small") guiLabelSetHorizontalAlign(loot_amountlabel, "center", false) guiLabelSetVerticalAlign(loot_amountlabel, "center") inv_takeammo = guiCreateButton(0.42, 0.10, 0.04, 0.09, "Take\nAmmo", true,inv_window) guiSetAlpha(inv_takeammo, 0.63) guiSetFont(inv_takeammo, "default-bold-small") guiSetProperty(inv_takeammo, "NormalTextColour", "FF000000") inv_takeall = guiCreateButton(0.42, 0.82, 0.04, 0.09, ">>", true,inv_window) guiSetAlpha(inv_takeall, 0.63) guiSetFont(inv_takeall, "default-bold-small") guiSetProperty(inv_takeall, "NormalTextColour", "FF000000") --[[inv_dropall = guiCreateButton(0.54, 0.82, 0.04, 0.09, "<<", true,inv_window) guiSetAlpha(inv_dropall, 0.63) guiSetFont(inv_dropall, "default-bold-small") guiSetProperty(inv_dropall, "NormalTextColour", "FF000000")]] HideGear = guiCreateCheckBox(0.03,0.05,0.11,0.04,"Hide Gear",true,true,inv_window) guiSetFont(HideGear,"default-bold-small") function showInventory(key,keyState) hideRightClickInventoryMenu() local col = getElementData(getLocalPlayer(),"currentCol") local gearName = getElementData(getLocalPlayer(),"lootname") refreshLoot(col,gearName) if getElementData(getLocalPlayer(),"logedin") and keyState == "down" then if guiGetVisible(inv_window) then guiSetVisible(inv_window,false) showCursor(false) else guiSetVisible(inv_window,true) showCursor(true) playSound("sounds/Inventory.mp3") end guiSetVisible(HideGear,false) if isPlayerInLoot() then if getElementData(col,"tent") then guiSetVisible(HideGear,true) if getElementData(col,"visible") then guiCheckBoxSetSelected(HideGear,false) else guiCheckBoxSetSelected(HideGear,true) end end end refreshInventory() if guiGetVisible(inv_window)== true then onClientOpenInventoryStopMenu() end end end bindKey("tab","down",showInventory) addEventHandler("onClientGUIClick",HideGear,function() col = isPlayerInLoot() if col then if guiCheckBoxGetSelected(HideGear) then setElementData(col,"visible",false) else setElementData(col,"visible",true) end end end) addEventHandler("onClientGUIClick",HideGear,function() col = isPlayerInLoot() if col then if guiCheckBoxGetSelected(HideGear) then setElementData(col,"visible",false) else setElementData(col,"visible",true) end end end) function Debugg() setElementData(getLocalPlayer(),"loot",false) end addEventHandler("onClientPlayerVehicleEnter",getRootElement(),Debugg) function hideInventoryManual() guiSetVisible(inv_window,false) showCursor(false) hideRightClickInventoryMenu() end addEvent("hideInventoryManual",true) addEventHandler("hideInventoryManual",getLocalPlayer(),hideInventoryManual) function refreshInventoryManual() refreshInventory() end addEvent("refreshInventoryManual",true) addEventHandler("refreshInventoryManual",getLocalPlayer(),refreshInventoryManual) function refreshLootManual(loot) refreshLoot(loot) end addEvent("refreshLootManual",true) addEventHandler("refreshLootManual",getLocalPlayer(),refreshLootManual) addEventHandler("onClientGUIClick",inv_takeammo,function() if isPlayerInLoot() and loot_lootcolumn then local countItem = guiGridListGetRowCount(loot_grid) for i = 0, countItem do local itemName = guiGridListGetItemText(loot_grid,i,1) for id, item in ipairs(inventoryItems["Ammo"]) do if itemName == item[1] and getElementData(isPlayerInLoot(),itemName) > 0 and not isToolbeltItem(itemName) then if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then local numbers = getElementData(isPlayerInLoot(),itemName) for i = 1, numbers do if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) else startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) setTimer(refreshInventory,100,1) return end end refreshButtonLoot() else startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) setTimer(refreshInventory,100,1) return end end end end end refreshButtonLoot() end,false) addEventHandler("onClientGUIClick",inv_takeall,function() local itemName = guiGridListGetItemText(loot_grid,guiGridListGetSelectedItem(loot_grid),1) if isPlayerInLoot() then if getElementData(isPlayerInLoot(),itemName) and getElementData(isPlayerInLoot(),itemName) >= 1 and not isToolbeltItem(itemName) then if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then local numbers = getElementData(isPlayerInLoot(),itemName) for i = 1, numbers do if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) else startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) return end refreshButtonLoot() end else startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) return end end refreshButtonLoot() end end) function refreshButtonLoot() if isPlayerInLoot() then local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,100,1) setTimer(refreshLoot,100,1,col,gearName) end end addEventHandler("onClientGUIClick",inv_dropall,function() if playerMovedInInventory then startRollMessage2("Inventory", "", 255, 22, 0 ) return end local itemName = guiGridListGetItemText(inv_itemsgrid,guiGridListGetSelectedItem(inv_itemsgrid),1) if getElementData(getLocalPlayer(),itemName) and getElementData(getLocalPlayer(),itemName) >= 1 then if isPlayerInLoot() then local isVehicle = getElementData(isPlayerInLoot(),"vehicle") local isTent = getElementData(isPlayerInLoot(),"tent") if isVehicle and not isTent then if isToolbeltItem(itemName) then local numbers = getElementData(isPlayerInLoot(),itemName) for i = 1, numbers do if getElementData(getLocalPlayer(),itemName) < 1 then return end if getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) > getLootMaxAviableSlots(isPlayerInLoot()) then startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) return end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) <= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end elseif isToolbeltItem(itemName) then local numbers = getElementData(isPlayerInLoot(),itemName) for i = 1, numbers do if getElementData(getLocalPlayer(),itemName) < 1 then return end if getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) > getLootMaxAviableSlots(isPlayerInLoot()) then startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) return end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) <= getLootMaxAviableSlots(isPlayerInLoot()) then local numbers = getElementData(isPlayerInLoot(),itemName) for i = 1, numbers do if getElementData(getLocalPlayer(),itemName) < 1 then return end if getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) > getLootMaxAviableSlots(isPlayerInLoot()) then startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) return end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end else startRollMessage2("Inventory", "Inventario Cheio!", 255, 22, 0 ) return end else local numbers = getElementData(getLocalPlayer(),itemName) for i = 1, numbers do if getElementData(getLocalPlayer(),itemName) < 1 then return end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end end end local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,100,1) if isPlayerInLoot() then setTimer(refreshLoot,100,1,col,gearName) end end) function refreshInventory() if(inv_itemscolumn) then row1,column1 = guiGridListGetSelectedItem(inv_itemsgrid) guiGridListClear(inv_itemsgrid) local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Armas Primárias",true,false) for id,item in ipairs(inventoryItems["Primary Weapon"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_1") and item[1] == getElementData(getLocalPlayer(),"currentweapon_1") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255, 0, 0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255, 0, 0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Armas Secundárias",true,false) for id,item in ipairs(inventoryItems["Secondary Weapon"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_2") and item[1] == getElementData(getLocalPlayer(),"currentweapon_2") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255, 0, 0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255, 0, 0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Armas Especiais",true,false) for id,item in ipairs(inventoryItems["Specially Weapon"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getElementData(getLocalPlayer(),"currentweapon_3") and item[1] == getElementData(getLocalPlayer(),"currentweapon_3") then guiGridListSetItemColor ( inv_itemsgrid, row, inv_itemscolumn,255, 0, 0) guiGridListSetItemColor ( inv_itemsgrid, row, inv_amountcolumn,255, 0, 0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Munição",true,false) for id,item in ipairs(inventoryItems["Ammo"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Comida e Bebida",true,false) for id,item in ipairs(inventoryItems["Food"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Suprimentos Médicos",true,false) for id,item in ipairs(inventoryItems["Medic"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Peças de Veículos",true,false) for id,item in ipairs(inventoryItems["VehicleParts"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Itens",true,false) for id,item in ipairs(inventoryItems["Items"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end end ----- Mochilas e Capacete local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Roupas",true,false) for id,item in ipairs(inventoryItems["Roupas"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) if getActiveVest(getLocalPlayer()) == item[1] then guiGridListSetItemColor(inv_itemsgrid,row,inv_itemscolumn,255, 0, 0) guiGridListSetItemColor(inv_itemsgrid,row,inv_amountcolumn,255, 0, 0) end if getActiveHelmet(getLocalPlayer()) == item[1] then guiGridListSetItemColor(inv_itemsgrid,row,inv_itemscolumn,255, 0, 0) guiGridListSetItemColor(inv_itemsgrid,row,inv_amountcolumn,255, 0, 0) end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Mochilas",true,false) for id,item in ipairs(inventoryItems["Mochilas"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) for i=1,#BackpacksTable do if item[1] == BackpacksTable[i][1] then if BackpacksTable[i][2] == getElementData(getLocalPlayer(),"MAX_Slots") then guiGridListSetItemColor(inv_itemsgrid,row,inv_itemscolumn,255, 0, 0) guiGridListSetItemColor(inv_itemsgrid,row,inv_amountcolumn,255, 0, 0) end end end end end local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,"- Ferramentas",true,false) for id,item in ipairs(inventoryItems["Toolbelt"])do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then local row = guiGridListAddRow(inv_itemsgrid) guiGridListSetItemText(inv_itemsgrid,row,inv_itemscolumn,item[1],false,false) guiGridListSetItemText(inv_itemsgrid,row,inv_amountcolumn,getElementData(getLocalPlayer(),item[1]),false,false) end end if row1 and column1 then guiGridListSetSelectedItem(inv_itemsgrid,row1,column1) end vestSlots = getActiveVestSlots(getLocalPlayer()) if vestSlots then guiSetText(inv_slotslabel,"Slots: "..getPlayerCurrentSlots()+vestSlots.."/"..getPlayerMaxAviableSlots().." + "..vestSlots) else guiSetText(inv_slotslabel,"Slots: "..getPlayerCurrentSlots().."/"..getPlayerMaxAviableSlots()) end end function refreshLoot(loot,gearName) if loot == false then guiGridListClear(loot_grid) guiSetText(loot_amountlabel,"Empty") guiSetText(LootLabel,"Gear") return end if(loot_lootcolumn) then row2,column2 = guiGridListGetSelectedItem(loot_grid) guiGridListClear(loot_grid) if gearName then guiSetText(LootLabel,gearName) end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Armas Primárias",true,false) for id,item in ipairs(inventoryItems["Primary Weapon"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Armas Secundárias",true,false) for id,item in ipairs(inventoryItems["Secondary Weapon"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Armas Especiais",true,false) for id,item in ipairs(inventoryItems["Specially Weapon"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Munição",true,false) for id,item in ipairs(inventoryItems["Ammo"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Comida e Bebida",true,false) for id,item in ipairs(inventoryItems["Food"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Suprimentos Médicos",true,false) for id,item in ipairs(inventoryItems["Medic"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Peças de Veículos",true,false) for id,item in ipairs(inventoryItems["VehicleParts"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Itens",true,false) for id,item in ipairs(inventoryItems["Items"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Roupas",true,false) for id,item in ipairs(inventoryItems["Roupas"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Mochilas",true,false) for id,item in ipairs(inventoryItems["Mochilas"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,"- Ferramentas",true,false) for id,item in ipairs(inventoryItems["Toolbelt"])do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then local row = guiGridListAddRow(loot_grid) guiGridListSetItemText(loot_grid,row,loot_lootcolumn,item[1],false,false) guiGridListSetItemText(loot_grid,row,loot_amountcolumn,getElementData(loot,item[1]),false,false) end end if row2 and column2 then guiGridListSetSelectedItem(loot_grid,row2,column2) end guiSetText(loot_amountlabel,"Slots: "..getLootCurrentSlots(loot).."/"..(getLootMaxAviableSlots(loot)or 0)) end end function getPlayerMaxAviableSlots() return getElementData(getLocalPlayer(),"MAX_Slots") end function getLootMaxAviableSlots(loot) return getElementData(loot,"MAX_Slots") end function getPlayerCurrentSlots() local current_SLOTS = 0 for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if getElementData(getLocalPlayer(),item[1]) and getElementData(getLocalPlayer(),item[1])>= 1 then current_SLOTS = current_SLOTS + item[2]*getElementData(getLocalPlayer(),item[1]) end end end if getActiveVest(getLocalPlayer()) then current_SLOTS = current_SLOTS - getActiveVestSlots(getLocalPlayer()) end if isWeaponEquiped(1) then current_SLOTS = current_SLOTS - 3 end if isWeaponEquiped(2) then current_SLOTS = current_SLOTS - 2 end if isWeaponEquiped(3) then current_SLOTS = current_SLOTS - 1 end if isWeaponEquiped(4) then current_SLOTS = current_SLOTS - 2 end return math.floor(current_SLOTS) end function getLootCurrentSlots(loot) local current_SLOTS = 0 for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if getElementData(loot,item[1]) and getElementData(loot,item[1])>= 1 then current_SLOTS = current_SLOTS + item[2]*getElementData(loot,item[1]) end end end return math.floor(current_SLOTS) end function getItemSlots(ItemName) for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if ItemName == item[1] then return item[2] end end end return false end function isToolbeltItem(ItemName) for id,item in ipairs(inventoryItems["Toolbelt"])do if ItemName == item[1] then return true end end return false end function getItemInfo(ItemName) for _,category in pairs(inventoryItems)do for id,item in pairs(category)do if ItemName == item[1] then return item[5] end end end return false end function onPlayerMoveItemOutOfInventory () if playerMovedInInventory then startRollMessage2("Inventory", "Abusing exploits will result in a ban!", 255, 22, 0 ) return end -- [ID:0000005 - Several grammar + spelling mistakes and typos] //L local itemName = guiGridListGetItemText(inv_itemsgrid,guiGridListGetSelectedItem(inv_itemsgrid),1) if getElementData(getLocalPlayer(),itemName) and getElementData(getLocalPlayer(),itemName) >= 1 then if isPlayerInLoot() then local isVehicle = getElementData(isPlayerInLoot(),"vehicle") local isTent = getElementData(isPlayerInLoot(),"tent") if isVehicle and not isTent then local veh = getElementData(isPlayerInLoot(),"parent") local tires,engine,parts = getVehicleAddonInfos (getElementModel(veh)) if itemName == "BUGADO" and (getElementData(isPlayerInLoot(),"Tire_inVehicle") or 0) < tires or itemName == "BUGADO" and (getElementData(isPlayerInLoot(),"Engine_inVehicle") or 0) < engine or itemName == "BUGADO" and (getElementData(isPlayerInLoot(),"Parts_inVehicle") or 0) < parts then if itemName == "BUGADO" then itemName = "BUGADO" end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName.."_inVehicle",isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) <= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory", "Inventário Cheio!", 255, 22, 0 ) -- [ID:0000005 - Several grammar + spelling mistakes and typos] //L return end elseif isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol")) + getItemSlots(itemName) <= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory", "Inventário Cheio!", 255, 22, 0 ) -- [ID:0000005 - Several grammar + spelling mistakes and typos] //L return end else triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) end end local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) if isPlayerInLoot() then setTimer(refreshLoot,200,2,col,gearName) end end addEventHandler ( "onClientGUIClick", inv_dropbutton, onPlayerMoveItemOutOfInventory ) function onPlayerMoveItemOutOFInventory(itemName,loot) keyState = getKeyState("lalt") itemPlus = getAmmoPlus(itemName) for i,weaponData in pairs(weaponTable)do if weaponData[1] == itemName then triggerServerEvent("removeBackWeaponOnDrop",getLocalPlayer()) end end if loot and not getElementData(loot,"itemloot") and getElementType(getElementData(loot,"parent"))== "vehicle" and itemName == "BUGADO" then engine,tires,parts,rotor,glass,slots,fuel,fuelpm = getVehicleAddonInfos(getElementModel(getElementData(loot,"parent"))) if getElementData(loot,"fuel")+ 20 < fuel then addingfuel = 20 elseif getElementData(loot,"fuel")+ 20 > fuel + 15 then triggerEvent("displayClientInfo",getLocalPlayer(),"Vehicle","O tanque de combustivel está 100% cheio",255,22,0) return else addingfuel = fuel - getElementData(loot,"fuel") end setElementData(loot,"fuel",getElementData(loot,"fuel")+ addingfuel) setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- itemPlus) setElementData(getLocalPlayer(),"BUGADO",(getElementData(getLocalPlayer(),"BUGADO")or 0)+ itemPlus) triggerEvent("displayClientInfo",getLocalPlayer(),"Vehicle","Você abasteceu alguns litros de combustivel no veículo!",22,255,0) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/Refuel.mp3",x,y,z),15) return end if getActiveVest(getLocalPlayer()) == itemName and getElementData(getLocalPlayer(),itemName) == 1 then startRollMessage2("Inventory","You can't drop your current vest!",255,22,0) return end if getActiveHelmet(getLocalPlayer()) == itemName and getElementData(getLocalPlayer(),itemName) == 1 then startRollMessage2("Inventory","You can't drop your current helmet!",255,22,0) return end if (getElementData(getLocalPlayer(),"wearingBackpack") == itemName) and (getElementData(getLocalPlayer(),getElementData(getLocalPlayer(),"wearingBackpack")) == 1) then startRollMessage2("Inventory","You can't drop your current backpack!",255,22,0) return true end if itemPlus > (getElementData(getLocalPlayer(),itemName) or 0) then itemPlus = getElementData(getLocalPlayer(),itemName) or 1 end if loot then avaliableSlotss = getLootMaxAviableSlots(loot) - getLootCurrentSlots(loot) if keyState then movingg = math.floor(avaliableSlotss/getItemSlots(itemName)) if movingg > getElementData(getLocalPlayer(),itemName) then movingg = getElementData(getLocalPlayer(),itemName) end setElementData(loot,itemName,(getElementData(loot,itemName)or 0)+ movingg) else setElementData(loot,itemName,(getElementData(loot,itemName)or 0)+ itemPlus) end local players = getElementsWithinColShape(loot,"player") if #players > 1 then triggerServerEvent("onPlayerChangeLoot",getRootElement(),loot) end else triggerServerEvent("playerDropAItem",getLocalPlayer(),itemName,itemPlus) setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- itemPlus) return end if itemName == "Tire_inVehicle" then itemName = "BUGADO" end if itemName == "Engine_inVehicle" then itemName = "BUGADO" end if itemName == "Parts_inVehicle" then itemName = "BUGADO" end if keyState then setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- movingg) else setElementData(getLocalPlayer(),itemName,getElementData(getLocalPlayer(),itemName)- itemPlus) end if loot and getElementData(loot,"itemloot") then triggerServerEvent("refre:~emLoot",getRootElement(),loot,getElementData(loot,"parent")) end end addEvent("onPlayerMoveItemOutOFInventory",true) addEventHandler("onPlayerMoveItemOutOFInventory",getRootElement(),onPlayerMoveItemOutOFInventory) function onPlayerMoveItemInInventory () local itemName = guiGridListGetItemText(loot_grid,guiGridListGetSelectedItem(loot_grid),1) if isPlayerInLoot() then if getElementData(isPlayerInLoot(),itemName) and getElementData(isPlayerInLoot(),itemName) >= 1 then if not isToolbeltItem(itemName) then if getPlayerCurrentSlots() + getItemSlots(itemName) <= getPlayerMaxAviableSlots() then if not playerMovedInInventory then triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory", "Abusing exploits will result in a ban!", 255, 22, 0 ) -- [ID:0000005 - Several grammar + spelling mistakes and typos] //L return end else startRollMessage2("Inventory", "Inventory is full!", 255, 22, 0 ) -- [ID:0000005 - Several grammar + spelling mistakes and typos] //L return end else playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end end if isPlayerInLoot() then local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) setTimer(refreshLoot,200,2,col,gearName) end end end addEventHandler ( "onClientGUIClick", loot_takebutton, onPlayerMoveItemInInventory ) function onPlayerMoveItemInInventory(itemName,loot) itemPlus = getAmmoPlus(itemName) if loot then if itemPlus > (getElementData(loot,itemName)or 0) then itemPlus = getElementData(loot,itemName) or 1 end local avaliableSlotss = getPlayerMaxAviableSlots() - getPlayerCurrentSlots() if keyState then movingg = math.floor(avaliableSlotss/getItemSlots(itemName)) if movingg > getElementData(loot,itemName) then movingg = getElementData(loot,itemName) end setElementData(getLocalPlayer(),itemName,(getElementData(getLocalPlayer(),itemName)or 0)+ movingg) else setElementData(getLocalPlayer(),itemName,(getElementData(getLocalPlayer(),itemName)or 0)+ itemPlus) end if itemPlus > 0 then if keyState then setElementData(loot,itemName,(getElementData(loot,itemName)or 0)- movingg) else setElementData(loot,itemName,getElementData(loot,itemName)- itemPlus) end end local players = getElementsWithinColShape(loot,"player") if #players > 1 then triggerServerEvent("onPlayerChangeLoot",getRootElement(),loot) end if getElementData(loot,"itemloot") then triggerServerEvent("refre:~emLoot",getRootElement(),loot,getElementData(loot,"parent")) end end end addEvent("onPlayerMoveItemInInventory",true) addEventHandler("onPlayerMoveItemInInventory",getRootElement(),onPlayerMoveItemInInventory) function onClientOpenInventoryStopMenu() triggerEvent("disableMenu",getLocalPlayer()) end function isPlayerInLoot() if getElementData(getLocalPlayer(),"loot") then return getElementData(getLocalPlayer(),"currentCol") end return false end ------------------------------------------------------------------------------ --right-click menu function onPlayerPressRightKeyInInventory() local itemName = guiGridListGetItemText ( inv_itemsgrid, guiGridListGetSelectedItem ( inv_itemsgrid ), 1 ) local itemName,itemInfo = getInventoryInfosForRightClickMenu(itemName) if isCursorShowing() and guiGetVisible(inv_window) and itemInfo then if itemName == "Box of Matches" then if getElementData(getLocalPlayer(),"Wood Pile")== 0 then return end end if itemName == "Bandage" then if getElementData(getLocalPlayer(),"bleeding")== 0 then return end end if itemName == "Antibiotics" and not getElementData(getLocalPlayer(),"infection") then return end if itemName == "Medic Kit" then if getElementData(getLocalPlayer(),"blood")> 10500 then return end end if itemName == "Heat Pack" then if getElementData(getLocalPlayer(),"temperature")> 35 then return end end if itemName == "Painkiller" then if not getElementData(getLocalPlayer(),"pain") then return end end if itemName == "Stinger" or itemName == "Trap" then if getPedOccupiedVehicle(getLocalPlayer()) then return end end if itemName == "Canned Spaghetti (Fechado)" or itemName == "Canned Baked Beans (Fechado)" or itemName == "Can of Tactical Bacon (Fechado)" or itemName == "Canned Sardines (Fechado)" then if getElementData(getLocalPlayer(),"Opener") == 0 then return end end if itemName == "Morphine" then if not getElementData(getLocalPlayer(),"brokenbone") then return end end if itemName == "Blood Bag" then return end if itemName == getElementData(getLocalPlayer(),"wearingBackpack") then itemInfo = "Remover Mochila" end if itemName == getActiveVest(getLocalPlayer()) then itemInfo = "Remover Colete" end if itemName == getActiveHelmet(getLocalPlayer()) then itemInfo = "Remover Capacete" end playerUseItem(itemName,itemInfo) end end --bindKey("mouse2","down",onPlayerPressRightKeyInInventory) addEventHandler("onClientGUIDoubleClick",inv_itemsgrid,onPlayerPressRightKeyInInventory,false) function getInventoryInfosForRightClickMenu(itemName) for i,itemInfo in ipairs(inventoryItems["Primary Weapon"])do if itemName == itemInfo[1] then return itemName,"Equipar Arma Primária" end end for i,itemInfo in ipairs(inventoryItems["Secondary Weapon"])do if itemName == itemInfo[1] then return itemName,"Equipar Arma Secundária" end end for i,itemInfo in ipairs(inventoryItems["Specially Weapon"])do if itemName == itemInfo[1] then return itemName,"Equipar Arma Especial" end end for i,itemInfo in ipairs(inventoryItems["Ammo"])do if itemName == itemInfo[1] then return itemName,false end end for i,itemInfo in ipairs(inventoryItems["Food"])do if itemName == itemInfo[1] then if itemInfo[1] == "Water Bottle" or itemInfo[1] == "Milk" or itemInfo[1] == "Soda Bottle" then info = "Beber" elseif itemInfo[1] == "Canned Baked Beans (Fechado)" or itemInfo[1] == "Canned Spaghetti (Fechado)" or itemInfo[1] == "Canned Sardines (Fechado)" or itemInfo[1] == "Can of Tactical Bacon (Fechado)" then info = "Abrir" else info = "Comer" end return itemName,info end end for i,itemInfo in ipairs(inventoryItems["Items"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["Roupas"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["Mochilas"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["Medic"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["VehicleParts"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end for i,itemInfo in ipairs(inventoryItems["Toolbelt"])do if itemName == itemInfo[1] then return itemName,itemInfo[3] or false end end end ------------------------------ RightClickMenu 1 ------------------------------ rightclickWindow = guiCreateStaticImage(0,0,0.05,0.0215,"images/scrollmenu_1.png",true) headline["rightclickmenu"] = guiCreateLabel(0,0,1,1,"",true,rightclickWindow) guiLabelSetHorizontalAlign (headline["rightclickmenu"],"center") guiLabelSetVerticalAlign (headline["rightclickmenu"],"center") guiSetFont (headline["rightclickmenu"], "default-bold-small" ) guiSetVisible(rightclickWindow,false) function hideRightClickInventoryMenu() guiSetVisible(rightclickWindow,false) end ------------------------------ RightClickMenu 1 ------------------------------ function onPlayerClickOnRightClickMenu (button,state) if button == "left" then local itemName,itemInfo = getElementData(rightclickWindow,"iteminfo")[1],getElementData(rightclickWindow,"iteminfo")[2] hideRightClickInventoryMenu () playerUseItem(itemName,itemInfo) end end addEventHandler("onClientGUIClick",headline["rightclickmenu"],onPlayerClickOnRightClickMenu,false) function playerUseItem(itemName,itemInfo) if itemInfo == "Beber" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/Drink.mp3",x,y,z),15) triggerServerEvent("onPlayerRequestChangingStats",getLocalPlayer(),itemName,itemInfo,"thirst") elseif itemInfo == "Comer" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/Eat.mp3",x,y,z),15) triggerServerEvent("onPlayerRequestChangingStats",getLocalPlayer(),itemName,itemInfo,"food") elseif itemInfo == "Abrir" then hideInventoryManual() setPedAnimation(getLocalPlayer(),"BOMBER","BOM_Plant",-1,false,false,false,false) triggerServerEvent("onPlayerOpenFood",getLocalPlayer(),itemName) elseif itemInfo == "Usar skin" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerChangeSkin",getLocalPlayer(),itemName) elseif itemName == "Empty Water Bottle" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerRefillWaterBottle",getLocalPlayer(),itemName) elseif itemInfo == "Set Rate" then guiSetVisible(SetGPSRateWindow,true) elseif itemName == "Tent" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerPitchATent",getLocalPlayer(),itemName) elseif itemInfo == "Colocar Wire Fence" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerBuildAWireFence",getLocalPlayer(),itemName) elseif itemName == "Roadflare" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerPlaceRoadflare",getLocalPlayer(),itemName) elseif itemInfo == "Make a Fire" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerMakeAFire",getLocalPlayer(),itemName) elseif itemName == "Morphine" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/Morphine.mp3",x,y,z),15) triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) elseif itemName == "Medic Kit" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/MedicKit.mp3",x,y,z),15) triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) elseif itemName == "Painkiller" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/Painkiller.mp3",x,y,z),15) triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) elseif itemName == "Bandage" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) x,y,z = getElementPosition(getLocalPlayer()) setSoundMaxDistance(playSound3D("sounds/Bandage.mp3",x,y,z),15) triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) elseif itemInfo == "Usar" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) triggerServerEvent("onPlayerUseMedicObject",getLocalPlayer(),itemName) elseif itemInfo == "Equipar Arma Primária" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/equip1.mp3") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,1) elseif itemInfo == "Equipar Arma Secundária" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/equip2.mp3") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,2) elseif itemInfo == "Equipar Arma Especial" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/equip3.mp3") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,3) elseif itemInfo == "Equipar Pistola" then refreshInventory() triggerEvent("hideInventoryManual",localPlayer) playSound("sounds/equip2.mp3") triggerServerEvent("onPlayerRearmWeapon",getLocalPlayer(),itemName,4) elseif itemInfo == "Set Rate" then hideInventoryManual() guiSetVisible(GUIEditor.window[1],not guiGetVisible(GUIEditor.window[1])) showCursor(not isCursorShowing()) elseif itemInfo == "Place Stinger" then setElementData(localPlayer,"Stinger",getElementData(localPlayer,"Stinger")-1) local x, y, z = getElementPosition(localPlayer) local rx, ry, rz = getElementRotation(localPlayer) x = x - math.sin(math.rad(rz))*2 y = y + math.cos(math.rad(rz))*2 rz = rz + 90 local groundZ = getGroundPosition(x,y,z) if(groundZ ~= z) then z = groundZ+0.2 end setPedAnimation(getLocalPlayer(),"BOMBER","BOM_Plant",-1,false,false,false,false) triggerServerEvent("CreateStinger",localPlayer,x,y,z,rz) elseif itemInfo == "Usar Colete" then --if getActiveVest(getLocalPlayer()) and getElementData(getLocalPlayer(),"vestLife") == getVestLife(getActiveVest(getLocalPlayer())) then --setElementData(getLocalPlayer(),getActiveVest(getLocalPlayer()),getElementData(getLocalPlayer(),getActiveVest(getLocalPlayer()))+1) --end for _,vest in pairs(VestsTable)do setElementData(localPlayer,vest[2],false) end for _,vest in pairs(VestsTable)do if vest[1] == itemName then var = vest[2] setElementData(getLocalPlayer(),"vestLife",vest[4]) break end end setElementData(localPlayer,var,true) refreshInventory() triggerEvent("hideInventoryManual",localPlayer) elseif itemInfo == "Usar Capacete" then --if getActiveHelmet(getLocalPlayer()) and getElementData(getLocalPlayer(),"helmetLife") == getHelmetLife(getActiveHelmet(getLocalPlayer())) then --setElementData(getLocalPlayer(),getActiveHelmet(getLocalPlayer()),getElementData(getLocalPlayer(),getActiveHelmet(getLocalPlayer()))+1) --end for _,helmet in pairs(HelmetsTable)do setElementData(localPlayer,helmet[2],false) end for _,helmet in pairs(HelmetsTable)do if helmet[1] == itemName then var = helmet[2] setElementData(getLocalPlayer(),"helmetLife",helmet[4]) break end end setElementData(localPlayer,var,true) refreshInventory() triggerEvent("hideInventoryManual",localPlayer) elseif itemInfo == "Vestir Mochila" then for _,backpack in pairs(BackpacksTable)do if itemName == backpack[1] then if getElementData(getLocalPlayer(),"MAX_Slots")== backpack[2] then triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Você já usando esta mochila!",255,22,0) elseif getPlayerCurrentSlots() > backpack[2] then triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Seus itens precisam estar abaixo de "..backpack[2].."!",255,22,0) else setElementData(getLocalPlayer(),"MAX_Slots",backpack[2]) setElementData(getLocalPlayer(),"wearingBackpack",backpack[1]) refreshInventory() triggerEvent("hideInventoryManual",localPlayer) end end end elseif itemInfo == "Remover Mochila" then if getPlayerCurrentSlots() <= 8 then setElementData(getLocalPlayer(),"MAX_Slots",8) setElementData(getLocalPlayer(),"wearingBackpack",false) refreshInventory() triggerEvent("hideInventoryManual",localPlayer) else triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Seus itens precisam estar abaixo de 8!",255,22,0) end elseif itemInfo == "Remover Colete" then vestSlots = getActiveVestSlots(getLocalPlayer()) if getElementData(getLocalPlayer(),"MAX_Slots")-vestSlots < getPlayerCurrentSlots() then triggerEvent("displayClientInfo",getLocalPlayer(),"inventory","Seus itens precisam estar abaixo de "..getElementData(getLocalPlayer(),"MAX_Slots").."!",255,22,0) return end setElementData(getLocalPlayer(),getActiveVestVar(getLocalPlayer()),false) refreshInventory() triggerEvent("hideInventoryManual",localPlayer) elseif itemInfo == "Remover Capacete" then setElementData(getLocalPlayer(),getActiveHelmetVar(getLocalPlayer()),false) refreshInventory() triggerEvent("hideInventoryManual",localPlayer) end refreshInventory() end addEvent("playerUseItem",true) addEventHandler("playerUseItem",getLocalPlayer(),playerUseItem) function weaponSwitch(ID) for _,item in pairs(weaponTable)do if getElementData(getLocalPlayer(),"currentweapon_1") == item[1] and ID == item[3] and item[5] == 1 then if getElementData(getLocalPlayer(),item[2])> 0 then setElementData(getLocalPlayer(),item[2],getElementData(getLocalPlayer(),item[2])- 1) return end end if getElementData(getLocalPlayer(),"currentweapon_2") == item[1] and ID == item[3] and item[5] == 2 then if getElementData(getLocalPlayer(),item[2])> 0 then setElementData(getLocalPlayer(),item[2],getElementData(getLocalPlayer(),item[2])- 1) end end if getElementData(getLocalPlayer(),"currentweapon_3") == item[1] and ID == item[3] and item[5] == 3 then if getElementData(getLocalPlayer(),item[1])> 0 then setElementData(getLocalPlayer(),item[1],getElementData(getLocalPlayer(),item[1])- 1) end end if getElementData(getLocalPlayer(),"currentweapon_4") == item[1] and ID == item[3] and item[5] == 4 then if getElementData(getLocalPlayer(),item[2])> 0 then setElementData(getLocalPlayer(),item[2],getElementData(getLocalPlayer(),item[2])- 1) end end end end addEventHandler("onClientPlayerWeaponFire",getLocalPlayer(),weaponSwitch) ------------------------------------------------------------ NEW INVENTORY ------------------------------------------------------------ function onPlayerMoveItemOutOfInventoryNew(itemName) if getElementData(getLocalPlayer(),"CantUseInv") then stateCounter = getElementData(getLocalPlayer(),"PingCounter") if not stateCounter then stateCounter = 0 end setElementData(getLocalPlayer(),"PingCounter",stateCounter + 1) end if playerMovedInInventory then return end if getElementData(getLocalPlayer(),itemName) and getElementData(getLocalPlayer(),itemName)>= 1 then if isPlayerInLoot() then local isVehicle = getElementData(isPlayerInLoot(),"vehicle") local isTent = getElementData(isPlayerInLoot(),"tent") if isVehicle and not isTent then local veh = getElementData(isPlayerInLoot(),"parent") engine,tires,parts,rotor,glass,slots,fuel,fuelpm = getVehicleAddonInfos(getElementModel(veh)) if itemName == "BUGADO" and(getElementData(isPlayerInLoot(),"Tire_inVehicle")or 0)< tires or itemName == "BUGADO" and(getElementData(isPlayerInLoot(),"Engine_inVehicle")or 0) < engine or itemName == "BUGADO" and(getElementData(isPlayerInLoot(),"Rotor_inVehicle")or 0) < rotor or itemName == "BUGADO" and(getElementData(isPlayerInLoot(),"Glass_inVehicle")or 0) < glass or itemName == "BUGADO" and(getElementData(isPlayerInLoot(),"Parts_inVehicle")or 0) < parts then if itemName == "BUGADO" then itemName = "Parts" end if itemName == "BUGADO" then itemName = "Rotor" end if itemName == "BUGADO" then itemName = "Glass" end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName.."_inVehicle",isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol"))+ getItemSlots(itemName)<= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory","Inventário cheio!",255,22,0) return end elseif isToolbeltItem(itemName) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) elseif getLootCurrentSlots(getElementData(getLocalPlayer(),"currentCol"))+ getItemSlots(itemName)<= getLootMaxAviableSlots(isPlayerInLoot()) then triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory","Inventário cheio!",255,22,0) return end else triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) end end end addEvent("onPlayerMoveItemOutOfInventoryNew",true) addEventHandler("onPlayerMoveItemOutOfInventoryNew",getLocalPlayer(),onPlayerMoveItemOutOfInventoryNew) function onPlayerMoveItemInInventoryNew(itemName) if getElementData(getLocalPlayer(),"CantUseInv") then stateCounter = getElementData(getLocalPlayer(),"PingCounter") if not stateCounter then stateCounter = 0 end setElementData(getLocalPlayer(),"PingCounter",stateCounter + 1) end if isPlayerInLoot() then if getElementData(isPlayerInLoot(),itemName) and (getElementData(isPlayerInLoot(),itemName)or 0)>= 1 then if not isToolbeltItem(itemName) then if getPlayerCurrentSlots()+ getItemSlots(itemName)<= getPlayerMaxAviableSlots() then if not playerMovedInInventory then triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else return end else startRollMessage2("Inventory","Inventário cheio!",255,22,0) return end else playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) triggerEvent("onPlayerMoveItemInInventory",getLocalPlayer(),itemName,isPlayerInLoot()) end end if isPlayerInLoot() then local gearName = guiGetText(LootLabel) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) setTimer(refreshLoot,200,2,col,gearName) end end end addEvent("onPlayerMoveItemInInventoryNew",true) addEventHandler("onPlayerMoveItemInInventoryNew",getLocalPlayer(),onPlayerMoveItemInInventoryNew) function getPedClothesID(thePed, clothingSlot) if not isElement(thePed) or type(clothingSlot) ~= "number" then error("Invalid arguments to setPedClothes()!", 2) end local texture, model = getPedClothes(thePed, clothingSlot) if not texture then return false else local _, id = getTypeIndexFromClothes(texture, model) return id end end
  20. Olá boa tarde, estou com o seguinte erro em meu bone attach ERROR: [DayZ-MTA]/DayZ/bone_attach/attach_func.lua:117: cannot resume dead coroutine [string "?"] [DUP x5] alguem poderia me dizer qual a causa desse erro? attached_ped = {} attached_bone = {} attached_x = {} attached_y = {} attached_z = {} attached_rx = {} attached_ry = {} attached_rz = {} function attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz) if not (isElement(element) and isElement(ped)) then return false end if getElementType(ped) ~= "ped" and getElementType(ped) ~= "player" then return false end bone = tonumber(bone) if not bone or bone < 1 or bone > 20 then return false end x,y,z,rx,ry,rz = tonumber(x) or 0,tonumber(y) or 0,tonumber(z) or 0,tonumber(rx) or 0,tonumber(ry) or 0,tonumber(rz) or 0 attached_ped[element] = ped attached_bone[element] = bone attached_x[element] = x attached_y[element] = y attached_z[element] = z attached_rx[element] = rx attached_ry[element] = ry attached_rz[element] = rz if setElementCollisionsEnabled then setElementCollisionsEnabled(element,false) end if script_serverside then triggerClientEvent("boneAttach_attach",root,element,ped,bone,x,y,z,rx,ry,rz) end return true end function detachElementFromBone(element) if not element then return false end if not attached_ped[element] then return false end clearAttachmentData(element) if setElementCollisionsEnabled then setElementCollisionsEnabled(element,true) end if script_serverside then triggerClientEvent("boneAttach_detach",root,element) end return true end function isElementAttachedToBone(element) if not element then return false end return isElement(attached_ped[element]) end function getElementBoneAttachmentDetails(element) if not isElementAttachedToBone(element) then return false end return attached_ped[element],attached_bone[element], attached_x[element],attached_y[element],attached_z[element], attached_rx[element],attached_ry[element],attached_rz[element] end function setElementBonePositionOffset(element,x,y,z) local ped,bone,ox,oy,oz,rx,ry,rz = getElementBoneAttachmentDetails(element) if not ped then return false end return attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz) end function setElementBoneRotationOffset(element,rx,ry,rz) local ped,bone,x,y,z,ox,oy,oz = getElementBoneAttachmentDetails(element) if not ped then return false end return attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz) end if not script_serverside then function getBonePositionAndRotation(ped,bone) bone = tonumber(bone) if not bone or bone < 1 or bone > 20 then return false end if not isElement(ped) then return false end if getElementType(ped) ~= "player" and getElementType(ped) ~= "ped" then return false end if not isElementStreamedIn(ped) then return false end local x,y,z = getPedBonePosition(ped,bone_0[bone]) local rx,ry,rz = getEulerAnglesFromMatrix(getBoneMatrix(ped,bone)) return x,y,z,rx,ry,rz end end ------------------------------------ function clearAttachmentData(element) attached_ped[element] = nil attached_bone[element] = nil attached_x[element] = nil attached_y[element] = nil attached_z[element] = nil attached_rx[element] = nil attached_ry[element] = nil attached_rz[element] = nil end function forgetDestroyedElements() if not attached_ped[source] then return end clearAttachmentData(source) end addEventHandler(script_serverside and "onElementDestroy" or "onClientElementDestroy",root,forgetDestroyedElements) function forgetNonExistingPeds() local checkedcount = 0 while true do for element,ped in pairs(attached_ped) do if not isElement(ped) then clearAttachmentData(element) end checkedcount = checkedcount+1 if checkedcount >= 1000 then coroutine.yield() checkedcount = 0 end end coroutine.yield() end end local clearing_nonexisting_peds = coroutine.create(forgetNonExistingPeds) setTimer(function() coroutine.resume(clearing_nonexisting_peds) end,1000,0)
  21. Este erro fica aparecendo várias vezes, e não consigo ver nada no log, por conta disso, alguem pode me ajudar? [18-11-03 21:43:54] ERROR: [DayZ-MTA]/DayZ/bone_attach/attach_func.lua:117: cannot resume dead coroutine [string "?"] [DUP x5] attached_ped = {} attached_bone = {} attached_x = {} attached_y = {} attached_z = {} attached_rx = {} attached_ry = {} attached_rz = {} function attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz) if not (isElement(element) and isElement(ped)) then return false end if getElementType(ped) ~= "ped" and getElementType(ped) ~= "player" then return false end bone = tonumber(bone) if not bone or bone < 1 or bone > 20 then return false end x,y,z,rx,ry,rz = tonumber(x) or 0,tonumber(y) or 0,tonumber(z) or 0,tonumber(rx) or 0,tonumber(ry) or 0,tonumber(rz) or 0 attached_ped[element] = ped attached_bone[element] = bone attached_x[element] = x attached_y[element] = y attached_z[element] = z attached_rx[element] = rx attached_ry[element] = ry attached_rz[element] = rz if setElementCollisionsEnabled then setElementCollisionsEnabled(element,false) end if script_serverside then triggerClientEvent("boneAttach_attach",root,element,ped,bone,x,y,z,rx,ry,rz) end return true end function detachElementFromBone(element) if not element then return false end if not attached_ped[element] then return false end clearAttachmentData(element) if setElementCollisionsEnabled then setElementCollisionsEnabled(element,true) end if script_serverside then triggerClientEvent("boneAttach_detach",root,element) end return true end function isElementAttachedToBone(element) if not element then return false end return isElement(attached_ped[element]) end function getElementBoneAttachmentDetails(element) if not isElementAttachedToBone(element) then return false end return attached_ped[element],attached_bone[element], attached_x[element],attached_y[element],attached_z[element], attached_rx[element],attached_ry[element],attached_rz[element] end function setElementBonePositionOffset(element,x,y,z) local ped,bone,ox,oy,oz,rx,ry,rz = getElementBoneAttachmentDetails(element) if not ped then return false end return attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz) end function setElementBoneRotationOffset(element,rx,ry,rz) local ped,bone,x,y,z,ox,oy,oz = getElementBoneAttachmentDetails(element) if not ped then return false end return attachElementToBone(element,ped,bone,x,y,z,rx,ry,rz) end if not script_serverside then function getBonePositionAndRotation(ped,bone) bone = tonumber(bone) if not bone or bone < 1 or bone > 20 then return false end if not isElement(ped) then return false end if getElementType(ped) ~= "player" and getElementType(ped) ~= "ped" then return false end if not isElementStreamedIn(ped) then return false end local x,y,z = getPedBonePosition(ped,bone_0[bone]) local rx,ry,rz = getEulerAnglesFromMatrix(getBoneMatrix(ped,bone)) return x,y,z,rx,ry,rz end end ------------------------------------ function clearAttachmentData(element) attached_ped[element] = nil attached_bone[element] = nil attached_x[element] = nil attached_y[element] = nil attached_z[element] = nil attached_rx[element] = nil attached_ry[element] = nil attached_rz[element] = nil end function forgetDestroyedElements() if not attached_ped[source] then return end clearAttachmentData(source) end addEventHandler(script_serverside and "onElementDestroy" or "onClientElementDestroy",root,forgetDestroyedElements) function forgetNonExistingPeds() local checkedcount = 0 while true do for element,ped in pairs(attached_ped) do if not isElement(ped) then clearAttachmentData(element) end checkedcount = checkedcount+1 if checkedcount >= 1000 then coroutine.yield() checkedcount = 0 end end coroutine.yield() end end clearing_nonexisting_peds = coroutine.create(forgetNonExistingPeds) --[[setTimer function() if coroutine.status ~= "dead" then coroutine.resume(clearing_nonexisting_peds) end end,1000,0 )]]
  22. Galera, alguem tem um bone attach do cj sem erros para me mandar? Estou precisando de um mas não acho em lugar algum
  23. complicado mano, queria fazer uma parceria com um scripter para poder me ajudar, não tenho tempo, isso que é ruim
  24. Entao, esse é o.problema, no debug nao da nenhum erro
×
×
  • Create New...