Jump to content

Lukkas2201

Members
  • Posts

    64
  • Joined

  • Last visited

Everything posted by Lukkas2201

  1. na internal? o certo não seria no registry.db? mas é o seguinte, não sei se esse codigo que vc me passou faz isso, mas meu rank ele ja atualiza e faz tudo sozinho, o unico problema é que quando o player sai do servidor, o nome dele some no rank o ruim é que eu realmente não sei fazer isso, e não tenho tempo pra ficar tentando, se é que me entende
  2. Olá, estou aqui novamente para falar sobre o sistema de salvamento de um rank que tenho, criei um topico esses dias e me disseram que eu teria que mexer com data base, porém eu estou a dias quebrando a cabeça e não sai nada, 2 madrugadas perdidas só tentando e não da nada, gostaria que alguem que tenha conhecimento com isso, fizesse pra mim, estou disposto até a pagar pelo serviço, ultimamente não tenho muito tempo pois trabalho, e o pouco tempo que tenho é para descansar, então se alguem puder, me mande algum contato para podermos conversar (sou brasileiro e só sei falar português)
  3. Olá, mais uma vez estou aqui pedindo a ajuda de vcs, vcs estão me ajudando bastante e agradeço muito. dessa vez o erro vai para o meu inventário, o que acontece, algumas vezes quando o jogador vai pegar um item no inventário, ele clica na seta para pegar, porém o item não vai para o inventário, ele fica só no loot, ai tem que ficar saindo e entrando no gear para poder voltar ao normal, (não é toda vez que acontece, mas quando acontece atrapalha bastante) e também quando estou colocando itens na tenda, eu coloco alguns itens na tenda, e depois começa ir para o chão, como se não tivesse tenda ali, oque poderia ser? meu inventory.lua -----------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 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 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") 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 == "Tank Parts" then itemName = "Parts" 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 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,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() if 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 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) 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 end --addEventHandler("onClientGUIClick",loot_takebutton,onPlayerMoveItemInInventory) addEventHandler ( "onClientGUIClick", loot_takebutton, onPlayerMoveItemInInventory ) --addEventHandler("onClientGUIDoubleClick",loot_grid,onPlayerMoveItemInInventory,false) 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
  4. Obrigado amigo, vi realmente que estava dando loop no helicrash, anulei a função e adicionei outra por cima e deu certo, obrigado !!
  5. Olá boa noite, me deparei com o seguinte erro em meu servidor, ja venho quebrando a cabeça, até pensei que fosse uma propria função no inventário, porém não é. seguinte, todos os carros do servidor tem espaço para guardar loot dentro dele, porém quando esse carro acaba explodindo, ao respawnar de novo, ele vem sem slots, vem 0/0. meu vehicle_spawns.lua se alguem puder me ajudar, por favor .. 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) 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, 500, 1, veh, source) setElementFrozen (veh,true) setElementData(veh,"repairer",source) setElementData(source,"repairingvehicle",veh) --setPedAnimation (source,"SCRATCHING","sclng_r",nil,true,false) triggerClientEvent (source, "displayClientInfo", source,"Vehicle","You started the repairs!",22,255,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","You have completed repairs!",255,0,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","You stopped the repair!",255,0,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)
  6. muito obrigado cara, isso vai ser muito útil, obrigado !!!
  7. se eu não me engano, a resource de zombies que eu tenho é fora dessa daí, ou seja, pra funcionar a zombies precisa dessa que o nome é npc_hlc, será que isso poderia ajudar?
  8. Boa noite, queria saber como faço para poder salvar os players que ficam no rank, porque quando o player sai do servidor, o nome dele desaparece do painel, gostaria de saber como faz para que fique salvo, pois estou tendo dificuldades para fazer isso, se precisarem posto o código do rank aqui.
  9. ah sim, a resource serve tipo para dar vida aos zombies do meu servidor, para que eles façam sua função corretamente. tinha entendido errado, me desculpe
  10. então amigo, eu também não sei, conheço o básico em programação lua, então sempre que recebo uma ajuda eu agradeço muito, não conheco muito e não tinha pra onde correr, ai vim pedir ajuda aqui no forum.
  11. poderia me dizer como ficaria então?
  12. então no lugar do task[2] ficaria como? player[2]?
  13. perdão, é que sou novo e não sabia onde postar pra falar a verdade são duas linhas agora que reparei [18-10-24 11:23:57] WARNING: npc_hlc/control_npc_s.lua:66: Bad argument @ 'setElementSyncer' [Expected player at argument 2, got colshape] [DUP x16] [18-10-24 11:23:57] WARNING: npc_hlc/control_npc_s.lua:31: Bad argument @ 'setElementSyncer' [Expected player at argument 2, got colshape] UPDATE_INTERVAL_MS = 2000 -- 2000 UPDATE_INTERVAL_MS_INV = 1/UPDATE_INTERVAL_MS UPDATE_INTERVAL_S = UPDATE_INTERVAL_MS*0.001 UPDATE_INTERVAL_S_INV = 1/UPDATE_INTERVAL_S function initNPCControl() addEvent("npc_hlc:onNPCTaskDone",false) setTimer(cycleNPCs,UPDATE_INTERVAL_MS,0) end function cycleNPCs() check_cols = get("npc_hlc.server_colchecking") == "true" and "true" or nil if check_cols then server_coldata = getResourceFromName("server_coldata") if server_coldata and getResourceState(server_coldata) == "running" then call(server_coldata,"generateColData") else check_cols = nil end end for npc,exists in pairs(all_npcs) do if isHLCEnabled(npc) then local syncer = getElementSyncer(getPedOccupiedVehicle(npc) or npc) local thistask = getElementData(npc,"npc_hlc:thistask") if thistask then local task = getElementData(npc,"npc_hlc:task."..thistask) if task and #task > 0 then if task[1] == "killPed" then if not syncer and isElement ( task[2] ) then setElementSyncer ( npc, task[2] ) end end end end if syncer then if unsynced_npcs[npc] then removeNPCFromUnsyncedList(npc) end else if not unsynced_npcs[npc] then addNPCToUnsyncedList(npc) end end else if unsynced_npcs[npc] then removeNPCFromUnsyncedList(npc) end end end local this_time = getTickCount() local gamespeed = getGameSpeed() for npc,unsynced in pairs(unsynced_npcs) do if getElementHealth(getPedOccupiedVehicle(npc) or npc) >= 1 then local time_diff = (this_time-getNPCLastUpdateTime(npc))*gamespeed while time_diff > 1 do local thistask = getElementData(npc,"npc_hlc:thistask") if thistask then local task = getElementData(npc,"npc_hlc:task."..thistask) if not task then removeElementData(npc,"npc_hlc:thistask") removeElementData(npc,"npc_hlc:lasttask") break else if task[1] == "killPed" and isElement ( task[2] ) then setElementSyncer ( npc, task[2] ) removeNPCFromUnsyncedList(npc) break else local prev_time_diff,prev_task = time_diff,task time_diff = time_diff-performTask[task[1]](npc,task,time_diff) if prev_time_diff ~= time_diff then break end if time_diff > 1 then setNPCTaskToNext(npc) end end end else break end end updateNPCLastUpdateTime(npc,this_time) end end end function setNPCTaskToNext(npc) local thistask = getElementData(npc,"npc_hlc:thistask") setElementData(npc,"npc_hlc:thistask",thistask+1) end function cleanUpDoneTasks(dataname,oldval) if notrigger then return end if not oldval or dataname ~= "npc_hlc:thistask" then return end local newval = getElementData(source,dataname) if not newval then return end if newval < oldval then notrigger = true setElementData(source,dataname,oldval) notrigger = nil end for tasknum = oldval,newval-1 do local taskstr = "npc_hlc:task."..tasknum local task = getElementData(source,taskstr) if task then triggerEvent("npc_hlc:onNPCTaskDone",source,task) removeElementData(source,taskstr) end end end o erro está na linha 31 e 66 onde contém linha 31: setElementSyncer ( npc, task[2] ) linha 66 setElementSyncer ( npc, task[2] ) sim já tentei traduzir porém não consegui resolver também.
  14. Olá, estou com um problema em uma resource minha o Erro está nesta linha, se alguem puder me ajudar agradeço de verdade!! ja tentei de tudo mas nada se resolve na verdade não é nem um erro, é um aviso, mas ele fica dando DUP toda hora, e acaba dando milhares de linha no log com esse mesmo aviso [18-10-21 19:34:48] WARNING: npc_hlc/control_npc_s.lua:31: Bad argument @ 'setElementSyncer' [Expected player at argument 2, got object]
×
×
  • Create New...