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

TalkAction Move all house items from players to depot and reset houses

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,766
Solutions
1
Reaction score
225
Location
Chile, Santiago
I have been working with this a while and developed this talkaction that may help a few admins to manage their server.

On your talkactions.xml add this line below <talkactions>:
HTML:
    <talkaction words="/emptyhouses" script="mhi.lua" />

Create a file named mhi.lua at talkaction/scripts/
Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end
   
    for _, house in ipairs(Game.getHouses()) do
        if house:getOwnerGuid() == 0 then
            --
        else
            house:setOwnerGuid(0)
            house:setAccessList(256, "")
            house:setAccessList(257, "")
            house:setAccessList(1, "")
        end
    end
   
    print("Items moved to depot.")
   
    return false
end

How it works?

First checks if the player executing the command has access.
Then it get all existing houses on game, and if they do have owner, then it resets to "0" the owner, and empty the invited list, subowners list and doors access list.

When the owner is set to "0", all items are moved to owner depot.

Hope this helps you guys!
 
Back
Top