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

CreatureEvent Tfs 0.4 Anti trash depots & actionid

hamburger or pizza

  • meatball

    Votes: 5 55.6%
  • bread

    Votes: 4 44.4%

  • Total voters
    9

GOD Wille

Excellent OT User
Joined
Jan 11, 2010
Messages
2,826
Solutions
2
Reaction score
815
Location
Sweden
I don't know if this has been made and relased but;
If you do not stand on a depot tile, you may not put any item at any depot locker, or at any tile with action id 7483. (Unless if you have group higher than 3) Also you won't be able to throw items except for in a square area around your character.

010a3d3c9175bce2b2c1a70a71a65356.png


It requires that you have this installed;
Feature - Creaturescript: onMoveItem(moveItem, frompos, position, cid)

login.lua
Lua:
        registerCreatureEvent(cid, "antiTrash")

creaturescripts.xml
XML:
    <event type="moveitem" name="antiTrash" script="antitrash.lua"/>

antitrash.lua
Lua:
local depottiles = {11062,416,417,425,426,446,447}
local depots = {2589,2590,2591,2592,10970}
local group = 3
   
local function checkIfThrow(pos,topos)
                    if topos.x == 0xffff then
                        return false
                    end
                local thing = getThingFromPos(pos)
                if isInArray(depottiles,thing.itemid) then
                            if not isInArea(topos,{x=pos.x-1,y=pos.y-1,z=pos.z},{x=pos.x+1,y=pos.y+1, z=pos.z}) then                   
                            return true
                        end   
                else   
                for i = 1, #depots do
                    if depots[i] == getTileItemById(topos,depots[i]).itemid or getTileInfo(topos).actionid == 7483 then
                        return true
                    end
                end
            end                               
    return false
end


function onMoveItem(cid, item, count, toContainer, fromContainer, fromPos, toPos)
    if isPlayer(cid) then
        local pos = getThingPos(cid)
            if getPlayerGroupId(cid) > group then
                return true
        end
           
        if checkIfThrow({x=pos.x,y=pos.y,z=pos.z,stackpos=0},toPos) then
            doPlayerSendCancel(cid,"You can't put items on this tile if you don't stand on a depot tile.")
            doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
            return false
        end
    end
    return true
end
 
Back
Top