JackSon04 Posted June 18, 2021 Posted June 18, 2021 Hi guys, what could be wrong with this code? function openInventory(Element) if (pElement) then if (showInventory) then showLeft = false else showInventory = true showLeft = true end triggerServerEvent("getElementItems", localPlayer, localPlayer, pElement, 2) activeSide = "bag" if getElementType(pElement) == "vehicle" then vehBoot = pElement if not getElementData(pElement, "veh >> bootOpened") then triggerServerEvent("toggleTrunk",localPlayer,pElement,1) setElementData(pElement, "veh >> bootOpened", true) end end end end
SpecT Posted June 19, 2021 Posted June 19, 2021 Hey, Well we could ask you the same question. What's doesn't work? Any errors from /debugscript 3 ? Something I noticed is that in the function it is used the variable called "pElement" which in the function arguments for some reason its "Element". Maybe this is the problem ?
RavenLoad Posted June 19, 2021 Posted June 19, 2021 17 hours ago, Eddison said: triggerServerEvent("getElementItems", localPlayer, localPlayer, pElement, 2) here you have 2 times localPlayer. so try: ------------------ function openInventory(Element) if (pElement) then if (showInventory) then showLeft = false else showInventory = true showLeft = true end triggerServerEvent("getElementItems", localPlayer, pElement, 2) activeSide = "bag" if getElementType(pElement) == "vehicle" then vehBoot = pElement if not getElementData(pElement, "veh >> bootOpened") then triggerServerEvent("toggleTrunk",localPlayer,pElement,1) setElementData(pElement, "veh >> bootOpened", true) end end end end ----------------- And dont forget about addEventHandler
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