• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Whats 'uid' and how to get it? I need it for: setItemArmor(uid, items_id)

Lua:
local uid = getThingFromPosition({x=1,y=1,z=1})
local uid = doCreateItem(here some params)

You can get UID of item from some position, you get it when you create new item, many 'scripts' got items in parameters like 'action'

Lua:
function onUse(cid, item)
-- HERE YOUR CODE, you can use:
-- to set armor to 123
setItemArmor(item.uid, 123)

end
 
Tried using this as a test, Console returned this:
Code:
[Error - Action Interface]
data/actions/scripts/custom/upgrade.lua:onUse
Description:
data/actions/scripts/custom/upgrade.lua:4: attempt to call global 'setItemArmor' <a nil value>
stack traceback:
data/actions/scripts/custom/upgrade.lua:4: in function<data/actions/scripts/custom/upgrade.lua:1>

And i used the script you posted.
Code:
[COLOR=#AA9900][B]function[/B][/COLOR] onUse[COLOR=#66CC66]([/COLOR]cid[COLOR=#66CC66],[/COLOR] item[COLOR=#66CC66])[/COLOR][COLOR=#808080][I]-- HERE YOUR CODE, you can use:[/I][/COLOR][COLOR=#808080][I]-- to set armor to 123[/I][/COLOR][COLOR=#417394]setItemArmor[/COLOR][COLOR=#66CC66]([/COLOR]item[COLOR=#66CC66].[/COLOR]uid[COLOR=#66CC66],[/COLOR] [COLOR=#CC66CC]123[/COLOR][COLOR=#66CC66])[/COLOR] [COLOR=#AA9900][B]end[/B][/COLOR][COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR]And i tryed modyfing it like so, same error though
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
-- HERE YOUR CODE, you can use:
-- to set armor to 123
setItemArmor(itemEx.uid, 123)
 
end


What could be cauzing this, Using TFS 0.3.7 For 9.7
 
Back
Top