Gripex Posted July 20, 2020 Share Posted July 20, 2020 (edited) local Playeritems = { ["Item1"] = true, ["Item2"] = true, ["Item3"] = true, ["Item4"] = true } addEvent("Items", true) addEventHandler("Items", root, function (Items) if assignShow then if #Items == 0 then return end assigns = Items img1 = Items[1] and {["img"] = "items/"..Items[1]["item"]..".png", ["key"] = Items[1]["key"]} img2 = Items[2] and {["img"] = "items/"..Items[2]["item"]..".png", ["key"] = Items[2]["key"]} img3 = Items[3] and {["img"] = "items/"..Items[3]["item"]..".png", ["key"] = Items[3]["key"]} img4 = Items[4] and {["img"] = "items/"..Items[4]["item"]..".png", ["key"] = Items[4]["key"]} img5 = Items[5] and {["img"] = "items/"..Items[5]["item"]..".png", ["key"] = Items[5]["key"]} else if #Items == 0 then removeEventHandler("onClientRender", root, assignUI) removeEventHandler("onClientClick", root, AssignClick) assignShow = false return end assigns = Items img1 = Items[1] and {["img"] = "items/"..Items[1]["item"]..".png", ["key"] = Items[1]["key"]} img2 = Items[2] and {["img"] = "items/"..Items[2]["item"]..".png", ["key"] = Items[2]["key"]} img3 = Items[3] and {["img"] = "items/"..Items[3]["item"]..".png", ["key"] = Items[3]["key"]} img4 = Items[4] and {["img"] = "items/"..Items[4]["item"]..".png", ["key"] = Items[4]["key"]} img5 = Items[5] and {["img"] = "items/"..Items[5]["item"]..".png", ["key"] = Items[5]["key"]} addEventHandler("onClientRender", root, assignUI) addEventHandler("onClientClick", root, AssignClick) assignShow = true end end) function AssignClick(bttn,state,cursorX,cursorY) if assignShow == false then return false end if bttn == "left" and state == "down" then for i = 1,5 do if isMouseInPosition(assignSlots[i][1], assignSlots[i][2], assignSlots[i][3], assignSlots[i][4]) then if assigns[i] then triggerServerEvent("removeAssignKey", resourceRoot, assigns[i]["key"], assigns[i]["item"]) end end end end end I Tried to do if get Playeritems[Items[1]["item"]] then Items[1]["item"] = "burger" end but it made bug on AssignClick, So any help i want make if get PlayerItems in any one from "Img1" to "Img5" so it change to "burger" For More Information if get Items[1]["item"] = "Item1" then Items[1]["item"] = "burger" oh IT Need if get Playeritems in any one if img i mean from 1 to 5 it work fine so it need loop counting from 1 to 5 Edited July 20, 2020 by Gripex Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now