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

Every player to have a container by default

Matheus Santos

New Member
Joined
Feb 26, 2015
Messages
3
Reaction score
0
Location
Brazil
Hey guys,

i'm trying to make every player have a container by default, let's call it "master container"
the reason why is simply to remove the backpack slot from which i find very unecessary
my initial thought process was to give every new player a backpack on the correct slot and hide it from the client
while it may seem a reasonable solution, i was wondering if i could make it through the source code because i want to be able to do something like this:
C++:
player->getMasterContainer()
i found container logic a little confusing so i decided to ask here for help, anyone around?
 
i'd say add a backpack and dont allow them to move it, data\events\scripts\player.lua:
Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if fromPosition.x == CONTAINER_POSITION and fromPosition.y == 3 then
        return RETURNVALUE_NOTPOSSIBLE
    end
end
 
i'd say add a backpack and dont allow them to move it, data\events\scripts\player.lua:
Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if fromPosition.x == CONTAINER_POSITION and fromPosition.y == 3 then
        return RETURNVALUE_NOTPOSSIBLE
    end
end
I see, i might do that, but does it guarantee the player will always have it? Sure, i will modify the player death script so he can never drop the backpack, that's all?

Where would be an ideal place to create the player backpack? I suppose i will add to login.lua, check for a backpack, if not, then create it, seems reasonable enough?
 
Back
Top