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

Lua [TFS 0.3.7 / 0.4] Check and remove Item witch ActionID.

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Hello.
I need script or function - check item and action.id.
When player have item with action.id == xxxx then
remove item with action.id

Thanks for all answer.
 
Solution
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.
Post automatically merged:

When the player uses an item with the specified actionID on another item, the first item with...
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 🔮🔮🔮🔮
 
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.
Post automatically merged:

When the player uses an item with the specified actionID on another item, the first item with specifed actionID is removed.

Thanks, I write this and works.

Lua:
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
 
Last edited:
Solution
Back
Top