It doesn't matter fow what the script is, I just want to know if im using the 'i' alright, or im doing it wrong.
The thing im trying to make, its that each time you press the item, a globalstoragevalue will be displayed, the first time you press it you'll get 1+i , 'i' will be 1 at that moment, but after that, I added a i = i +1, so if you press it again it will be i + 1 but 'i' will be 2 at that moment. I just want to be sure that this is correct! (And if its wrong then fix it
)
EDIT: I'd like to know if I can call a table this way too.
2 terms for [ ]
The thing im trying to make, its that each time you press the item, a globalstoragevalue will be displayed, the first time you press it you'll get 1+i , 'i' will be 1 at that moment, but after that, I added a i = i +1, so if you press it again it will be i + 1 but 'i' will be 2 at that moment. I just want to be sure that this is correct! (And if its wrong then fix it
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
i = 1
local v = t[item.uid]
if v then
if p(cid,v[1]) == -1 then
setGlobalStorageValue(cid,v[2],1+i)
setPlayerStorageValue(cid,v[1],2)
doRemoveItem(getThingfromPos(v[3]).uid,1)
i = i+1
return true
end
EDIT: I'd like to know if I can call a table this way too.
LUA:
local m = mix[getGlobalStorageValue(cid,globalstorageG) and getGlobalStorageValue(cid,globalstorageR)]
2 terms for [ ]