• 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 Players can put items into Shop Inbox

Majster12

Member
Joined
Feb 20, 2009
Messages
134
Solutions
1
Reaction score
16
vCWNUv7.gif

TFS 1.2
When i change like this no one can put items to bag/bacpkack.

players.lua
Code:
        -- Do not let the player insert items into either the Reward Container or the Reward Chest
        local itemId = container:getId()     
        if itemId == ITEM_REWARD_CONTAINER or itemId == ITEM_REWARD_CHEST or 26052 then
            self:sendCancelMessage('Sorry, not possible.')
            return false
        end
<item id="26052" name="shop inbox" />
 
Last edited:
You have to use
Code:
itemId == 26052

The statement 26052 alone will always evaluate to true in lua.
 
You have to use
Code:
itemId == 26052

The statement 26052 alone will always evaluate to true in lua.
There is another problem.
Players can put items to container in Shop Inbox.
sBBjosE.gif


Code:
        -- Do not let the player insert items into either the Reward Container or the Reward Chest or Shop Inbox
        local itemId = container:getId()       
        if itemId == ITEM_REWARD_CONTAINER or itemId == ITEM_REWARD_CHEST or itemId == 26052 then
            self:sendCancelMessage('Sorry, not possible.')
            return false
        end
 
Last edited:
if the only containers in shop inbox is zaoan chess containers, check if id == zaoan chess, then get parent and see if it is store inbox, if it can be any id, and any number of containers deep, use a recursive function that gets the parent container until it is the top-most container, and check if it is store inbox

item:getParent()
 
if the only containers in shop inbox is zaoan chess containers, check if id == zaoan chess, then get parent and see if it is store inbox, if it can be any id, and any number of containers deep, use a recursive function that gets the parent container until it is the top-most container, and check if it is store inbox

item:getParent()
Not work as it should.
Code:
        local item = Item(20620,2596)
        if item:getParent(26052) then
            self:sendCancelMessage('Sorry, not possible.')
            return false
        end
But what about this?
4A85miB.gif
 
hey! sap, addin this to my player.lua in events

Code:
  local item = Item(20620,2596)
        if item:getParent(26052) then
            self:sendCancelMessage('Sorry, not possible.')
            return false
        end

im getting an error at the loading of the server, actually i get

Code:
> Loading items
>> Loading script systems

Lua Script Error: [Event Interface] 
data/events/scripts/player.lua
data/events/scripts/player.lua:4: attempt to index local 'item' (a nil value)
stack traceback:
    [C]: in function '__index'
    data/events/scripts/player.lua:4: in main chunk
[Warning - Events::load] Can not load script: player.lua

>> Loading monsters
>> Loading outfits


what could it be?
 
hey! sap, addin this to my player.lua in events

Code:
  local item = Item(20620,2596)
        if item:getParent(26052) then
            self:sendCancelMessage('Sorry, not possible.')
            return false
        end

im getting an error at the loading of the server, actually i get

Code:
> Loading items
>> Loading script systems

Lua Script Error: [Event Interface]
data/events/scripts/player.lua
data/events/scripts/player.lua:4: attempt to index local 'item' (a nil value)
stack traceback:
    [C]: in function '__index'
    data/events/scripts/player.lua:4: in main chunk
[Warning - Events::load] Can not load script: player.lua

>> Loading monsters
>> Loading outfits


what could it be?
you cant even use that script because it creates item userdata out of thin air
you cant get parent if it gets created out of thin air
 
Back
Top