Postado Maio 23, 2015 9 anos So fazer o que disse acima. oque? vai bugar o doPlayerAddItem (e talvez doPlayerAddItemEx) @fix int32_t LuaScriptInterface::luaDoPlayerAddItem(lua_State* L) { //doPlayerAddItem(cid, itemid[, count/subtype = 1[, canDropOnMap = true[, slot = 0]]]) //doPlayerAddItem(cid, itemid[, count = 1[, canDropOnMap = true[, subtype = 1[, slot = 0]]]]) int32_t params = lua_gettop(L), subType = 1, slot = SLOT_WHEREEVER; if(params > 5) slot = popNumber(L); if(params > 4) { if(params > 5) subType = popNumber(L); else slot = popNumber(L); } bool canDropOnMap = true; if(params > 3) canDropOnMap = popNumber(L); uint32_t count = 1; if(params > 2) count = popNumber(L); uint32_t itemId = popNumber(L); if(slot > SLOT_AMMO) { errorEx("Invalid slot."); lua_pushboolean(L, false); return 1; } ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID((uint32_t)popNumber(L)); if(!player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } const ItemType& it = Item::items[itemId]; int32_t itemCount = 1; if(params > 4) itemCount = std::max((uint32_t)1, count); else if(it.hasSubType()) { if(it.stackable) itemCount = (int32_t)std::ceil((float)count / 100); subType = count; } while(itemCount > 0) { int32_t stackCount = std::min(100, subType); Item* newItem = Item::CreateItem(itemId, stackCount); if(!newItem) { errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if(it.stackable) subType -= stackCount; ReturnValue ret = g_game.internalPlayerAddItem(NULL, player, newItem, canDropOnMap, (slots_t)slot); if(ret != RET_NOERROR) { delete newItem; lua_pushboolean(L, false); return 1; } --itemCount; if(itemCount) continue; if(newItem->getParent()) lua_pushnumber(L, env->addThing(newItem)); else //stackable item stacked with existing object, newItem will be released lua_pushnil(L); return 1; } lua_pushnil(L); return 1; } int32_t LuaScriptInterface::luaDoPlayerAddItemEx(lua_State* L) { //doPlayerAddItemEx(cid, uid[, canDropOnMap = false[, slot = 0]]) int32_t params = lua_gettop(L), slot = SLOT_WHEREEVER; if(params > 3) slot = popNumber(L); bool canDropOnMap = false; if(params > 2) canDropOnMap = popNumber(L); uint32_t uid = (uint32_t)popNumber(L); if(slot > SLOT_AMMO) { errorEx("Invalid slot."); lua_pushboolean(L, false); return 1; } ScriptEnviroment* env = getEnv(); Player* player = env->getPlayerByUID(popNumber(L)); if(!player) { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); return 1; } Item* item = env->getItemByUID(uid); if(!item) { errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND)); lua_pushboolean(L, false); return 1; } if(item->getParent() == VirtualCylinder::virtualCylinder) lua_pushnumber(L, g_game.internalPlayerAddItem(NULL, player, item, canDropOnMap, (slots_t)slot)); else lua_pushboolean(L, false); return 1; } Quando você falou que o doPlayeraddItem ia bugar oque seria? porque eu testei uma script com a função doPlayerAddItem e está funcionando normal o único problema é que quando é adicionado os items na backpack eles não se juntam só isso
Postado Maio 25, 2015 9 anos oque? Quando você falou que o doPlayeraddItem ia bugar oque seria? porque eu testei uma script com a função doPlayerAddItem e está funcionando normal o único problema é que quando é adicionado os items na backpack eles não se juntam só isso Etao e esse problema.
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.