• 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!

Lock Item

setembro

New Member
Joined
May 22, 2008
Messages
110
Reaction score
1
HI, have 1 problem in script.

function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = {
a = {6578, 3213, 3213, 341, 3213}, -- allowed items to lock
b = (getGlobalStorageValue(2912)+7000)
}
if getItemAttribute(item.uid, "aid") >= 1 then
doPlayerSendCancel(cid, "Sorry, this item is already locked, if it's not locked please contact the owner")
end
if isInArray(t.a, item.itemid) then
doItemSetAttribute(item.uid, "aid", t.b)
doPlayerSetStorageValue(cid, 2912, (getGlobalStroageValue(2912)))
doItemSetAttribute(item.uid, "name", getItemInfo(item.itemid).name .. " that belongs to ".. getCreatureName(cid))
doPlayerSendTextMessage(cid, 21, "This item has been marked as yours!")
setGlobalStorageValue((b)+1)
end
return TRUE
end


On i used msg \/

[0:51:10.890] [Error - Action Interface]
[0:51:10.906] data/actions/scripts/lock.lua:eek:nUse
[0:51:10.906] Description:
[0:51:10.906] data/actions/scripts/lock.lua:6: attempt to compare number with ni
l
[0:51:10.906] stack traceback:
[0:51:10.906] data/actions/scripts/lock.lua:6: in function <data/actions/scrip
ts/lock.lua:1>



I ADD REP ++
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = {
	a = {1234, 3213, 3213, 341, 3213}, -- allowed items to lock
	b = (getGlobalStorageValue(2912)+7000)
}
	if isInArray(t.a, item.itemid) then
		doItemSetAttribute(item.uid, "aid", t.b)
		doPlayerSetStorageValue(cid, 2912, (getGlobalStroageValue(2912))
		doItemSetAttribute(item.uid, "name", getItemInfo(item.itemid).name .. " that belongs to ".. getCreatureName(cid))
		doPlayerSendTextMessage(cid, 21, "This item has been marked as yours!")
		setGlobalStorageValue((b)+1)
	end
return TRUE
end
 
Last edited:
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = {
	a = {1234, 3213, 3213, 341, 3213}, -- allowed items to lock
	b = (getGlobalStorageValue(2912)+7000)
}
if getItemAttribute(item.uid, 'aid') == NILL then
	if isInArray(t.a, item.itemid) then
		doItemSetAttribute(item.uid, "aid", t.b)
		doPlayerSetStorageValue(cid, 2912, (getGlobalStroageValue(2912))
		doItemSetAttribute(item.uid, "name", getItemInfo(item.itemid).name .. " that belongs to ".. getCreatureName(cid))
		doPlayerSendTextMessage(cid, 21, "This item has been marked as yours!")
		setGlobalStorageValue((b)+1)
	end
	else
		doPlayerSendCancel(cid, "Sorry, this item is already locked, if it's not locked contact the owner")
end
return TRUE
end


No have error msg, but not work.
 
Back
Top