Kra esse codigo deu erro
ompilador: Default compilerBuilding Makefile: "C:\Documents and Settings\Solrac\Meus documentos\Akira\Sky's Heart\Sky's Heart\0.3.6pl1.r102\dev-cpp\Makefile.win"
Executando make...
make.exe -f "C:\Documents and Settings\Solrac\Meus documentos\Akira\Sky's Heart\Sky's Heart\0.3.6pl1.r102\dev-cpp\Makefile.win" all
g++.exe -c ../luascript.cpp -o obj//luascript.o -I"C:/Documents and Settings/Solrac/Meus documentos/Akira/Sky's Heart/Stian's Repack Dev-Cpp/include" -D__USE_MYSQL__ -D__USE_SQLITE__ -D__ENABLE_SERVER_DIAGNOSTIC__ -fexpensive-optimizations -O1
In file included from ../ioguild.h:22,
from ../player.h:35,
from ../luascript.cpp:26:
../player.h:901:7: warning: no newline at end of file
In file included from ../luascript.cpp:26:
../player.h:445: error: `void Player::setSkillLevel(skills_t, uint32_t)' and `void Player::setSkillLevel(skills_t, uint32_t)' cannot be overloaded
In file included from ../luascript.cpp:26:
../player.h:901:7: warning: no newline at end of file
../luascript.cpp: In static member function `static int32_t LuaScriptInterface::luaDoPlayerSetMagicLevel(lua_State*)':
../luascript.cpp:8606: error: 'class Player' has no member named 'setMagicLevel'
make.exe: *** [obj//luascript.o] Error 1
Execução terminada
eu eu uso a versão TFS 0.3.6pl1
a do setskill pego mais esse do magic nao ![]()




info
Grupo: Visconde
Registrado: 27/02/13
Posts: 446
Reputação: +282
Gênero: Masculino
--º OrochiElf º--
Função testada na versao
TFS 0.3.6pl1
Essa funçao é capaz de setar e remover uma magic level em tempo real, sem precisar relogar para ter resultados.
Bom , vamos iniciar a instalaçao , vá em LUASCRIPT.CPP e procure por
Abaixo adicione :
Procure por
int32_t LuaScriptInterface::luaDoPlayerSetMaxCapacity(lua_State* L) { //doPlayerSetMaxCapacity(uid, cap) double cap = popFloatNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->setCapacity(cap); lua_pushboolean(L, true); } else { errorEx(getError(LUA_ERROR_PLAYER_NOT_FOUND)); lua_pushboolean(L, false); } return 1; }e abaixo adicione
int32_t LuaScriptInterface::luaDoPlayerSetMagicLevel(lua_State* L) { //doPlayerSetMagicLevel(uid, value) uint64_t value = popNumber(L); ScriptEnviroment* env = getEnv(); if(Player* player = env->getPlayerByUID(popNumber(L))) { player->setMagicLevel(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
void Player::addExperience(uint64_t exp) { uint32_t prevLevel = level; uint64_t nextLevelExp = Player::getExpForLevel(level + 1); if(Player::getExpForLevel(level) > nextLevelExp) { //player has reached max level levelPercent = 0; sendStats(); return; } experience += exp; while(experience >= nextLevelExp) { healthMax += vocation->getGain(GAIN_HEALTH); health += vocation->getGain(GAIN_HEALTH); manaMax += vocation->getGain(GAIN_MANA); mana += vocation->getGain(GAIN_MANA); capacity += vocation->getGainCap(); ++level; nextLevelExp = Player::getExpForLevel(level + 1); if(Player::getExpForLevel(level) > nextLevelExp) //player has reached max level break; } if(prevLevel != level) { updateBaseSpeed(); setBaseSpeed(getBaseSpeed()); g_game.changeSpeed(this, 0); g_game.addCreatureHealth(this); if(getParty()) getParty()->updateSharedExperience(); char advMsg[60]; sprintf(advMsg, "You advanced from Level %d to Level %d.", prevLevel, level); sendTextMessage(MSG_EVENT_ADVANCE, advMsg); CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__LEVEL, prevLevel, level); } uint64_t currLevelExp = Player::getExpForLevel(level); nextLevelExp = Player::getExpForLevel(level + 1); levelPercent = 0; if(nextLevelExp > currLevelExp) levelPercent = Player::getPercentLevel(experience - currLevelExp, nextLevelExp - currLevelExp); sendStats(); }E abaixo adicione
void Player::setMagicLevel(uint64_t value) { uint64_t old_level = magLevel; magLevel = value; manaSpent = 0; magLevelPercent = 0; CreatureEventList advanceEvents = getCreatureEvents(CREATURE_EVENT_ADVANCE); for(CreatureEventList::iterator it = advanceEvents.begin(); it != advanceEvents.end(); ++it) (*it)->executeAdvance(this, SKILL__MAGLEVEL, old_level, magLevel); sendStats(); }Agora pra finalizar vá em PLAYER.H e procure por
E "ACIMA" voce adiciona
----------------------------------------------------------------
Como usar?
doPlayerSetMagicLevel(cid, 10) -- Adiciona 10 pontos de ml
doPlayerSetMagicLevel(cid, -10) -- Remove 10 pontos de ml
Espero que façam bom uso :3