Ir para conteúdo

Auto Reset Player


honux

Posts Recomendados

Créditos : Me ( Kyo :p )

Tinha um kra pedindo o code em php, como eu só sei C++ eu fiz :p

no Player.cpp

Procure por

 

  lvMsg << "You advanced from level " << lastLv << " to level " << level << ".";

 

em seguida adicione :

 

        this->doReset();

 

no final adicione :

 

void Player::doReset(){int lvl;lvl = (g_config.getGlobalNumber("resetlvl"));     if(level == (lvl-1))     {  std::stringstream reMsg;  reMsg << "Atenção, seu char será resetado no level seguinte, tome cuidado.";        sendTextMessage(MSG_ADVANCE,reMsg.str().c_str());      }     if(level >= lvl)     {      level = 10;      experience = 9300;  std::stringstream lvMsg;  lvMsg << "You advanced from level " << lvl << " to level 10. Your skills still the same.";        sendTextMessage(MSG_ADVANCE,lvMsg.str().c_str());      }     else {     return;     }}

 

Agora em Player.h

Debaixo de Public adicione

 

    void doReset();

 

Agora no Config.lua adicione:

 

-- resetlvl-- Reset the player when he gots this lvlresetlvl = "350"

 

Eu botei assim, quando o player atinge um lvl a menos do que o indicado no config.lua manda um aviso, e quando ele atinge o lvl é resetado :p

Configure no Config.lua o lvl desejado do reset....

code bem simples q vai facilitar a vida d uma gente ai :p

Kyo ~*

Link para o comentário
Compartilhar em outros sites

Valeu cara!!!

=D

mas só uma coisa...pode fazer isso depois de compilar ou tem que fazer isso e compilar de novo? pelo que eu entendi é antes de compilar...mas na dúvida, ta aí a pergunta! =P

Link para o comentário
Compartilhar em outros sites

to com umas duvidas Oo

1º: isso ai tem q faze nas sources separadas?

2º: quando eu compilo essas sources separadas, na hora q eu clico em Project > Compile, aparece la em baixo "File not found". isso eh normal??

Link para o comentário
Compartilhar em outros sites

bom cara, essas sources separadas que eu to falando são as que baixam em outro link...

por exemplo, eu baixei o Yurots 0.93 do GM Addict, e nesse tópico têm lá:

YurOTS 0.9.3 Server By GM Addict

YurOTS 0.9.3 Sources By GM Addict

foi isso que eu quis dizer...

e no tutorial de compilação, eu li sim...mas axho que errei numa coisinha lá q eu já corrigi!

Valeu!

_______________________________________________________________

Fiz tudo certo...cheguei no final deu um monte de erro nas sources...tentei baixar pelo CVS mas nada...

Aqui tá o Log do que aconteceu, que por acaso nao entendi nada...

Compiler: Default compiler

Building Makefile: "C:\Dev-Cpp\otserv\Makefile.win"

Executing  make...

make.exe -f "C:\Dev-Cpp\otserv\Makefile.win" all

g++.exe -c "../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/account.cpp" -o "../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/account.o" -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/others/lua-5.0.2/include"  -I"C:/Dev-Cpp/others/boost_1_31_0"  -D__EXCEPTION_TRACER__ 

g++.exe -c "../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.cpp" -o "../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.o" -I"C:/Dev-Cpp/include"  -I"C:/Dev-Cpp/others/lua-5.0.2/include"  -I"C:/Dev-Cpp/others/boost_1_31_0"  -D__EXCEPTION_TRACER__ 

In file included from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/templates.h:29,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/creature.h:32,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/player.h:25,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.cpp:24:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:34:21: windows.h: No such file or directory

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:40:21: winsock.h: No such file or directory

In file included from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/templates.h:29,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/creature.h:32,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/player.h:25,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.cpp:24:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:77: error: `HANDLE' does not name a type

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:86: error: `OTSYS_THREAD_WAITSIGNAL' declared as an `inline' variable

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:86: error: `OTSYS_THREAD_SIGNALVAR' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:86: error: `signal' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:86: error: `CRITICAL_SECTION' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:86: error: `lock' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:87: error: initializer expression list treated as compound expression

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:87: error: expected `,' or `;' before '{' token

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h: In function `void OTSYS_SLEEP(uint32_t)':

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:98: error: `Sleep' undeclared (first use this function)

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:98: error: (Each undeclared identifier is reported only once for each function it appears in.)

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h: At global scope:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:102: error: `OTSYS_THREAD_WAITSIGNAL_TIMED' declared as an `inline' variable

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:102: error: `OTSYS_THREAD_SIGNALVAR' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:102: error: `signal' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:102: error: `CRITICAL_SECTION' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:102: error: `lock' was not declared in this scope

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:102: error: expected primary-expression before "long"

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:103: error: initializer expression list treated as compound expression

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:103: error: expected `,' or `;' before '{' token

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:262: error: expected `)' before '&' token

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:267: error: expected `)' before '&' token

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:276: error: ISO C++ forbids declaration of `CRITICAL_SECTION' with no type

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:276: error: expected `;' before '*' token

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h: In destructor `OTSYS_THREAD_LOCK_CLASS::~OTSYS_THREAD_LOCK_CLASS()':

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:273: error: `mutex' undeclared (first use this function)

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/otsystem.h:273: error: `LeaveCriticalSection' undeclared (first use this function)

In file included from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/creature.h:32,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/player.h:25,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.cpp:24:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/templates.h: At global scope:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/templates.h:80: error: `CRITICAL_SECTION' does not name a type

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/templates.h: In constructor `AutoID::AutoID()':

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/templates.h:57: error: `autoIDLock' undeclared (first use this function)

In file included from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/monster.h:27,

                from ../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.cpp:25:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/game.h: At global scope:

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/game.h:293: error: `CRITICAL_SECTION' does not name a type

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/game.h:432: error: `CRITICAL_SECTION' does not name a type

../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/game.h:433: error: `OTSYS_THREAD_SIGNALVAR' does not name a type

make.exe: *** ["../../Documents and Settings/Administrador/Meus documentos/Downloads/Addict Sources 0.93/actions.o"] Error 1

Execution terminated

Link para o comentário
Compartilhar em outros sites

Ghoust

Exite uma maneria 'especial' de compilar o Yurots, que pelo jeito vc não sabia disso :p

Irei procurar o tutorial certo e postar aqui :p

Este erro ( da compilação ) ocorre porque o Yurots não foi compilado no Dev-C++ que nem a maioria dos OtServers...

enquanto isso use outro OtServer :p

O Link pro tutorial está aqui :

http://www.xtibia.com/forum/index.php?showtopic=4536

Kyo ~*

Editado por honux
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...