This a code to do a item that set cap of player.
but I don't know How to use the function to set player capacity...
Someone can help me?
in luascript.cpp has this:
but I don't know How to use the function to set player capacity...
Someone can help me?
C++:
int32_t storage;
player->getStorageValue(71234, storage);
std::cout << "Storage: " << storage << "\n";
if (equip && storage != 1) {
std::cout << "added storage";
player->addStorageValue(71234, 1);
}
else {
if (storage == 1) {
std::cout << "removed storage";
player->addStorageValue(71234, -1);
}
}
in luascript.cpp has this:
C++:
int LuaScriptInterface::luaPlayerSetCapacity(lua_State* L)
{
// player:setCapacity(capacity)
Player* player = getUserdata<Player>(L, 1);
if (player) {
player->capacity = getNumber<uint32_t>(L, 2);
player->sendStats();
pushBoolean(L, true);
} else {
lua_pushnil(L);
}
return 1;
}