Narutimmy Posted June 20, 2014 Share Posted June 20, 2014 Hola tengo un problin.... En este codigo quiero modificarlo, Cuando yo saco un item de mi inventario (onPlayerMoveItemOutOFInventory) el item seleccionano queda seleccionado y puedo tirar todos los items imaginen son 5000 balas. Pero cuando yo quiero pasar un item del loot a mi inventario (onPlayerMoveItemInInventory) despues de dalre click y enviar el item a mi inventario el loot se refresca y debo seleccionar el item de nuevo lo cual es molesto si tienes que pasar nose 5000 municiones tu inventario. function onPlayerMoveItemOutOfInventory () if playerMovedInInventory then startRollMessage2("Inventory", "Si continuas intentando bugar ítems será suspendido.", 255, 22, 0 ) return end local itemName = guiGridListGetItemText ( gridlistItems["inventory"], guiGridListGetSelectedItem ( gridlistItems["inventory"] ), 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 == "Tire" and (getElementData(isPlayerInLoot(),"Tire_inVehicle") or 0) < tires or itemName == "Engine" and (getElementData(isPlayerInLoot(),"Engine_inVehicle") or 0) < engine or itemName == "Parts" and (getElementData(isPlayerInLoot(),"Parts_inVehicle") or 0) < parts or itemName == "Tank Parts" and (getElementData(isPlayerInLoot(),"Parts_inVehicle") or 0) < parts then if (getElementData(getLocalPlayer(),"Toolbox") >= 1) then playSound("sounds/repair.mp3") if itemName == "Tank Parts" then itemName = "Parts" end triggerEvent("onPlayerMoveItemOutOFInventory",getLocalPlayer(),itemName.."_inVehicle",isPlayerInLoot()) playerMovedInInventory = true setTimer(function() playerMovedInInventory = false end,700,1) else startRollMessage2("Inventory", "Necesitas un Toolbox", 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", "Inventario Lleno", 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", "Inventario Lleno", 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(headline["loot"]) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) if isPlayerInLoot() then setTimer(refreshLoot,200,2,col,gearName) end end addEventHandler ( "onClientGUIClick", buttonItems["inventory"], onPlayerMoveItemOutOfInventory ) function onPlayerMoveItemOutOFInventory(itemName, loot) local itemPlus = 1 if itemName == "Berta Mag" then itemPlus = 7 elseif itemName == "PB1s Mag" then itemPlus = 15 elseif itemName == "Desert Eagle Mag" then itemPlus = 7 elseif itemName == "PDW Mag" then itemPlus = 30 elseif itemName == "Viper 5 Mag" then itemPlus = 20 elseif itemName == "AK Mag" then itemPlus = 30 elseif itemName == "LR300 Mag" then itemPlus = 20 elseif itemName == "GAU-19 Mag" then itemPlus = 300 elseif itemName == "TOS 34 Pellet" then itemPlus = 7 elseif itemName == "BM16 Pellet" then itemPlus = 2 elseif itemName == "SPSA 14 Pellet" then itemPlus = 7 elseif itemName == "SVDm 2 Mag" then itemPlus = 5 elseif itemName == ".50 Barret Mag" then itemPlus = 5 elseif itemName == "Ballesta Mag" then itemPlus = 10 elseif itemName == "Sig550 Mag" then itemPlus = 10 elseif itemName == "M136 Rocket" then itemPlus = 5 elseif itemName == "LR300" or itemName == "GAU-19" or itemName == "Ak74" or itemName == "SVDm 2" or itemName == "TOS 34" or itemName == "SPSA 14" or itemName == "BM16" or itemName == "Heat-Seeking RPG" or itemName == "M136 Rocket Launcher" or itemName == "Ballesta" or itemName == "Sig550" then triggerServerEvent("removeBackWeaponOnDrop", getLocalPlayer()) end if loot and not getElementData(loot, "itemloot") and getElementType(getElementData(loot, "parent")) == "vehicle" and itemName == "Full Gas Canister" then if getElementData(loot, "fuel") + 20 < getVehicleMaxFuel(loot) then addingfuel = 20 elseif getElementData(loot, "fuel") + 20 > getVehicleMaxFuel(loot) + 15 then triggerEvent("displayClientInfo", getLocalPlayer(), "Vehicle", "El tanque de combustible está 100% lleno", 255, 22, 0) return else addingfuel = getVehicleMaxFuel(loot) - getElementData(loot, "fuel") end setElementData(loot, "fuel", getElementData(loot, "fuel") + addingfuel) setElementData(getLocalPlayer(), itemName, getElementData(getLocalPlayer(), itemName) - itemPlus) setElementData(getLocalPlayer(), "Empty Gas Canister", (getElementData(getLocalPlayer(), "Empty Gas Canister") or 0) + itemPlus) triggerEvent("displayClientInfo", getLocalPlayer(), "Vehicle", "Usted aprovisionó algunos litros de combustible en el vehículo!", 22, 255, 0) playSound("sounds/refuel.mp3") return end itemName2 = itemName if itemName == "Tire_inVehicle" then itemName2 = "Tire" end if itemName == "Engine_inVehicle" then itemName2 = "Engine" end if itemName == "Parts_inVehicle" then itemName2 = "Tank Parts" end if 1 > (getElementData(getLocalPlayer(), itemName2) or 0) / itemPlus then triggerEvent("displayClientInfo", getLocalPlayer(), "Inventory", "No puede dejar ese ítem!", 255, 22, 0) return end if loot then setElementData(loot, itemName, (getElementData(loot, itemName) or 0) + 1) do local players = getElementsWithinColShape(loot, "player") if #players > 1 then triggerServerEvent("onPlayerChangeLoot", getRootElement(), loot) end end if not getElementData(loot, "itemloot") and getElementType(getElementData(loot, "parent")) == "vehicle" then end else triggerServerEvent("playerDropAItem", getLocalPlayer(), itemName) end if itemName == "Tire_inVehicle" then itemName = "Tire" end if itemName == "Engine_inVehicle" then itemName = "Engine" end if itemName == "Parts_inVehicle" then itemName = "Tank Parts" end setElementData(getLocalPlayer(), itemName, getElementData(getLocalPlayer(), itemName) - itemPlus) if loot and getElementData(loot, "itemloot") then triggerServerEvent("refreshItemLoot", getRootElement(), loot, getElementData(loot, "parent")) end end addEvent("onPlayerMoveItemOutOFInventory", true) addEventHandler("onPlayerMoveItemOutOFInventory", getRootElement(), onPlayerMoveItemOutOFInventory) function onPlayerMoveItemInInventory () local itemName = guiGridListGetItemText ( gridlistItems["loot"], guiGridListGetSelectedItem ( gridlistItems["loot"] ), 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", "Si continuas intentando bugar ítems será suspendido.", 255, 22, 0 ) return end else startRollMessage2("Inventory", "Inventario Lleno", 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(headline["loot"]) local col = getElementData(getLocalPlayer(),"currentCol") setTimer(refreshInventory,200,2) setTimer(refreshLoot,200,2,col,gearName) setElementData(getLocalPlayer(),"SLOTS",getPlayerCurrentSlots(getLocalPlayer())) end end end addEventHandler ( "onClientGUIClick", buttonItems["loot"], onPlayerMoveItemInInventory ) function onPlayerMoveItemInInventory(itemName, loot) local itemPlus = 1 if itemName == "Berta Mag" then itemPlus = 7 elseif itemName == "PB1s Mag" then itemPlus = 15 elseif itemName == "Desert Eagle Mag" then itemPlus = 7 elseif itemName == "PDW Mag" then itemPlus = 30 elseif itemName == "Viper 5 Mag" then itemPlus = 20 elseif itemName == "AK Mag" then itemPlus = 30 elseif itemName == "LR300 Mag" then itemPlus = 20 elseif itemName == "GAU-19 Mag" then itemPlus = 300 elseif itemName == "TOS 34 Pellet" then itemPlus = 7 elseif itemName == "BM16 Pellet" then itemPlus = Link to comment
Recommended Posts