1.) When the player uses an item with a specific actionID, this item is removed.
2.) When the player uses an item with the specified actionID on another item, the other item is removed.
3.) When the player uses some onUse event, all items in the player's inventory with the specified actionID are removed.
4.) An example code so that when executed, all the player inventory will be check and if there are any items with a specific actionID they will be remove.
Please, more context![]()
When the player uses an item with the specified actionID on another item, the first item with...
This is for TFS 1.X, please for TFS 0.3.7 / 0.4LUA:if item:getActionId() == 2000 then item:remove() end
function onUse(cid, item, fromPos, target, toPos, isHotkey)
if item.actionid == xxxx then
doRemoveItem(item.uid, 1)
end
return true
end
LUA:function onUse(cid, item, fromPos, target, toPos, isHotkey) if item.actionid == xxxx then doRemoveItem(item.uid, 1) end return true end
1.) When the player uses an item with a specific actionID, this item is removed.No... This is bad code.
You give me if item.actionid .... I need if player have item with action.id...
1.) When the player uses an item with a specific actionID, this item is removed.
2.) When the player uses an item with the specified actionID on another item, the other item is removed.
3.) When the player uses some onUse event, all items in the player's inventory with the specified actionID are removed.
4.) An example code so that when executed, all the player inventory will be check and if there are any items with a specific actionID they will be remove.
Please, more context![]()
When the player uses an item with the specified actionID on another item, the first item with specifed actionID is removed.
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
[2088] = {action = 2088, storage = 2444},
[2091] = {action = 2091, storage = 4002},
[2087] = {action = 2087, storage = 4003},
[2092] = {action = 2092, storage = 4004},
[2086] = {action = 2086, storage = 4005}
}
local action = config[item.aid].action
local storage = config[item.aid].storage
local chest = itemEx.actionid == 5868
if chest and item.actionid == action then
doPlayerSendCancel(cid, "OK" ..storage )
doRemoveItem(item.uid, 1)
else
doPlayerSendCancel(cid, "NOK")
end
return true
end