Jump to content

Gripex

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by Gripex

  1. Gripex

    [Help]Loops

    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
  2. Yes, Server Side had items name and saved on DB its return to client side but i want when it return of get item name of server side just make photo of it as i want, u understand me? I mean if return Test so if get item called Test it return to image called "Name" But i want data to save it
  3. i mean there are Much Items to make it export img with other name and if i restarted scripts then names what i typed it it will remove! u got me ? it's exports item names from ServerSide but i want it export other name of image if assigns[i]["item"] == "Buster" then assigns[i]["item"] = "pizza" end if assigns[i]["item"] == "Other" then assigns[i]["item"] = "pizza" end if assigns[i]["item"] == "Test2" then assigns[i]["item"] = "burger" end u got me ?
  4. There aren't way to make list for changing item? Without command And I need count from 1 to 5 inside it bcs if item in img2 or any one so it work fine
  5. addEvent("showItems", true) addEventHandler("showItems", root, function (assignItems) if assignShow then if #assignItems == 0 then iprint(assignShow) return end assigns = assignItems img1 = assignItems[1] and {["img"] = ":images/"..assignItems[1]["item"]..".png", ["key"] = assignItems[1]["key"]} img2 = assignItems[2] and {["img"] = ":images/"..assignItems[2]["item"]..".png", ["key"] = assignItems[2]["key"]} img3 = assignItems[3] and {["img"] = ":images/"..assignItems[3]["item"]..".png", ["key"] = assignItems[3]["key"]} img4 = assignItems[4] and {["img"] = ":images/"..assignItems[4]["item"]..".png", ["key"] = assignItems[4]["key"]} img5 = assignItems[5] and {["img"] = ":images/"..assignItems[5]["item"]..".png", ["key"] = assignItems[5]["key"]} else if #assignItems == 0 then removeEventHandler("onClientRender", root, assignKeysUI) removeEventHandler("onClientClick", root, assignKeysRemove) assignShow = false return end assigns = assignItems img1 = assignItems[1] and {["img"] = ":images/"..assignItems[1]["item"]..".png", ["key"] = assignItems[1]["key"]} img2 = assignItems[2] and {["img"] = ":images/"..assignItems[2]["item"]..".png", ["key"] = assignItems[2]["key"]} img3 = assignItems[3] and {["img"] = ":images/"..assignItems[3]["item"]..".png", ["key"] = assignItems[3]["key"]} img4 = assignItems[4] and {["img"] = ":images/"..assignItems[4]["item"]..".png", ["key"] = assignItems[4]["key"]} img5 = assignItems[5] and {["img"] = ":images/"..assignItems[5]["item"]..".png", ["key"] = assignItems[5]["key"]} addEventHandler("onClientRender", root, assignKeysUI) addEventHandler("onClientClick", root, assignKeysRemove) assignShow = true end end) Thats cleaned COde, i want if get assignItems[1]["item"] like assignItems[1]["item"] == "Test" then change Test to Any name i want it like assignItems[1]["item"] == "Test1"
  6. function Remove() if assignShow == false then return false end for i = 1,5 do if isMouseInRectPosition(assignSlots[i][1], assignSlots[i][2], assignSlots[i][3], assignSlots[i][4]) then if assigns[i] then triggerServerEvent("remove", resourceRoot, assigns[i]["key"], assigns[i]["item"]) iprint(assigns[i]["key"], assigns[i]["item"]) end end end end addEvent("showItems", true) addEventHandler("showItems", root, function (assignItems) if assignShow then if #assignItems == 0 then iprint(assignShow) return end assigns = assignItems local maxKeys = 5 iprint(assignShow) for i, v in ipairs(assigns) do if assigns[i]["item"] == "Buster" then assigns[i]["item"] = "pizza" end img1 = assignItems[1] and {["img"] = ":images/"..assignItems[1]["item"]..".png", ["key"] = assignItems[1]["key"]} img2 = assignItems[2] and {["img"] = ":images/"..assignItems[2]["item"]..".png", ["key"] = assignItems[2]["key"]} img3 = assignItems[3] and {["img"] = ":images/"..assignItems[3]["item"]..".png", ["key"] = assignItems[3]["key"]} img4 = assignItems[4] and {["img"] = ":images/"..assignItems[4]["item"]..".png", ["key"] = assignItems[4]["key"]} img5 = assignItems[5] and {["img"] = ":images/"..assignItems[5]["item"]..".png", ["key"] = assignItems[5]["key"]} if i >= maxKeys then break end end else if #assignItems == 0 then removeEventHandler("onClientClick", root, assignKeysRemove) assignShow = false iprint(assignShow) return end assigns = assignItems local maxKeys = 5 iprint(assignShow) for i, v in ipairs(assigns) do if assigns[i]["item"] == "Buster" then assigns[i]["item"] = "pizza" end img1 = assignItems[1] and {["img"] = ":images/"..assignItems[1]["item"]..".png", ["key"] = assignItems[1]["key"]} img2 = assignItems[2] and {["img"] = ":images/"..assignItems[2]["item"]..".png", ["key"] = assignItems[2]["key"]} img3 = assignItems[3] and {["img"] = ":images/"..assignItems[3]["item"]..".png", ["key"] = assignItems[3]["key"]} img4 = assignItems[4] and {["img"] = ":images/"..assignItems[4]["item"]..".png", ["key"] = assignItems[4]["key"]} img5 = assignItems[5] and {["img"] = ":images/"..assignItems[5]["item"]..".png", ["key"] = assignItems[5]["key"]} if i >= maxKeys then break end end addEventHandler("onClientClick", root, Remove) assignShow = true end end) it had Problem when i click on isMouseInRectPosition(assignSlots[1], assignSlots[2], assignSlots[3], assignSlots[4]) iprint work but item doesn't remove but if i removed this loop for i, v in ipairs(assigns) do it will work fine, any Help?
×
×
  • Create New...