This system require this creraturescript:
http://otland.net/f35/creaturescript-onmoveitem-moveitem-frompos-position-cid-96742/
When you install this creaturescript just add this code and you will never worry about item clon in your server:
If you want save the player house too...
http://otland.net/f35/creaturescript-onmoveitem-moveitem-frompos-position-cid-96742/
When you install this creaturescript just add this code and you will never worry about item clon in your server:
Code:
function onMoveItem(moveItem, frompos, position, cid)
if cid and isPlayer(cid) then
doSavePlayer(cid)
end
return true
end
function onTradeAccept(cid, target, item)
doSavePlayer(cid)
doSavePlayer(target)
return true
end
If you want save the player house too...
int32_t LuaScriptInterface::luadoSaveHouse(lua_State* L)
{
//doSaveHouse(houseId)
bool displayError = true;
if(lua_gettop(L) > 1)
displayError = popNumber(L);
House* house = Houses::getInstance()->getHouse(popNumber(L));
if(!house)
{
if(displayError)
errorEx(getError(LUA_ERROR_HOUSE_NOT_FOUND));
lua_pushboolean(L, false);
return 1;
}
Database* db = Database::getInstance();
DBTransaction trans(db);
if(!trans.begin())
return false;
IOMapSerialize::getInstance()->saveHouse(db,house);
lua_pushboolean(L, trans.commit());
return 1;
}
Last edited: