Peço o script pro infeliz Orocheca(créditos: CarlosLendário) via skype, e em vez do bloco de notas ele me passa o link do xtibia
["Tudo por um REP+"] AHuaHAUHuhahauehuauheauhhua, ta ae teu REP! ![]()
@EDIT
Só amanhã o rep ![]()
"fã bar" aheauhuhahueauhae
Por Tony Araujo, 10 de mar. de 2013 em Linguagens de Programação
info
Grupo: Campones
Registrado: 04/02/13
Posts: 53
Reputação: +6
Char no Tibia: Goombas

Peço o script pro infeliz Orocheca(créditos: CarlosLendário) via skype, e em vez do bloco de notas ele me passa o link do xtibia
["Tudo por um REP+"] AHuaHAUHuhahauehuauheauhhua, ta ae teu REP! ![]()
@EDIT
Só amanhã o rep ![]()
"fã bar" aheauhuhahueauhae
Editado Março 14 por Goomba
info
Grupo: Conde
Registrado: 03/09/11
Posts: 703
Reputação: +191
Gênero: Masculino
Char no Tibia: Mirade

Orochi Nos Mostrando o Porque
Dele Ter Vindo Pra xTibia, Muito Bom!
Qual parte do código faz a atualização do sql?
E alias, pra que fazer isso tudo? não seria mais fácil um doPlayerSave(cid) ?
function doPlayerSetSkillLevel(cid, skill_id, level) if not isPlayer(cid) then return false end local skill_tries = getPlayerRequiredSkillTries(cid, skill, level) doPlayerAddSkillTry(cid, skill_id, skill_tries) doPlayerSave(cid) return true end
info
Grupo: Visconde
Registrado: 27/02/13
Posts: 446
Reputação: +282
Gênero: Masculino
--º By: OrochiElf º--
Função testada na versao
TFS 0.3.6pl1
Essa funçao como diz o titulo , adiciona direto os pontos de SKILLS, com o ID escolhidlo. sem precisar "RELOGAR", para atulizar o SQL.
Bom ,então vamos começar a instalar.
Primeiro vá em LUASCRIPT.CPP, e procure por
E logo abaixo adicione
Procure por
int32_t LuaScriptInterface::luaDoSendDistanceShoot(lua_State* L) { //doSendDistanceShoot(fromPos, toPos, type[, player]) ScriptEnviroment* env = getEnv(); SpectatorVec list; if(lua_gettop(L) > 3) { if(Creature* creature = env->getCreatureByUID(popNumber(L))) list.push_back(creature); } uint32_t type = popNumber(L); PositionEx toPos, fromPos; popPosition(L, toPos); popPosition(L, fromPos); if(fromPos.x == 0xFFFF) fromPos = env->getRealPos(); if(toPos.x == 0xFFFF) toPos = env->getRealPos(); if(!list.empty()) g_game.addDistanceEffect(list, fromPos, toPos, type); else g_game.addDistanceEffect(fromPos, toPos, type); lua_pushboolean(L, true); return 1; }E abaixo adicione
int32_t LuaScriptInterface::luaDoPlayerSetSkillLevel(lua_State* L) { //doPlayerSetSkillLevel(uid, skill, value) uint32_t value = popNumber(L); int32_t skill = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->setSkillLevel((skills_t) skill, value); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; }Agora vá em LUASCRIPT.H e procure por
e abaixo adicione
agora vá em player.cpp e procure por
uint64_t nextReqMana = vocation->getReqMana(magLevel + 1); if(!magLevel) { if (amount > manaSpent) amount = manaSpent; magLevel = 0; manaSpent -= amount; amount = 0; } bool downgrade = false; while(amount > manaSpent) { amount -= manaSpent + 1; magLevel--; nextReqMana = vocation->getReqMana(magLevel + 1); manaSpent = nextReqMana > 0 ? nextReqMana - 1 : nextReqMana; magLevelPercent = 0; char advMsg[50]; sprintf(advMsg, "You downgraded to magic level %d.", magLevel); sendTextMessage(MSG_EVENT_ADVANCE, advMsg); downgrade = true; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__MAGLEVEL, (magLevel + 1), magLevel); if (!magLevel) { if (amount > manaSpent) amount = manaSpent; magLevel = 0; manaSpent -= amount; amount = 0; break; } } if(amount) manaSpent -= amount; nextReqMana = vocation->getReqMana(magLevel + 1); uint32_t newPercent = Player::getPercentLevel(manaSpent, nextReqMana); if(magLevelPercent != newPercent) { magLevelPercent = newPercent; sendStats(); } else if(downgrade) sendStats(); }E abaixo adicione
void Player::setSkillLevel(skills_t skill, uint32_t value) { uint32_t old_level = skills[skill][SKILL_LEVEL]; skills[skill][SKILL_LEVEL] = value; skills[skill][SKILL_TRIES] = 0; skills[skill][SKILL_PERCENT] = 0; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, skill, old_level, skills[skill][SKILL_LEVEL]); sendSkills(); }Para finalizar vá em PLAYER.H e procure por
E abaixo adicione
-------------------------------------------------------------------------------------------------------
Exemplo de uso
Editado Julho 30 por OrochiElf