• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

protocolgame in tfs 10.90

zxzxzx

New Member
Joined
Mar 12, 2011
Messages
334
Reaction score
3
Hello! I wanted to compile my tfs 1.2 so that my HP/MANA bar displays in a percents not amount like 4200 HP/ 1000 Mana must be like 100 HP/100 MP, I am looking for help here:
https://otland.net/threads/jak-wysylac-hp-i-mane-w-procentach.181560/

but in my protocolgame.cpp there is no lines like that... (using new tfs 10.90)

here is link to my protocolgame.cpp:
http://www.filedropper.com/protocolgame

(I don't know how to upload long files like that on this page sorry)


please help! rep for help!
 
Try changing these lines:
Code:
msg.add<uint16_t>(std::min<int32_t>(player->getHealth(), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(std::min<int32_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH), std::numeric_limits<uint16_t>::max()));
To:
Code:
msg.add<uint16_t>(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int32_t>(creature->getMaxHealth(), 1)) * 100));
msg.add<uint16_t>(100);
 
Up friend, but there is no "Addplayerstats" lines - like in other tfs's I dont have this lines and this is the problem.. :<
 
tfs 10.90 protocolgame.cpp is diferend

i try to replace my protocolgame.cpp with .cpp which you posted but I have errors:

Code:
1>..\src\protocolgame.cpp(45): error C2084: function 'ProtocolGame::ProtocolGame(Connection_ptr)' already has a body
1>  c:\users\damian\desktop\tfs 10.90\src\protocolgame.h(72): note: see previous definition of '{ctor}'
1>..\src\protocolgame.cpp(54): error C2512: 'ProtocolGameBase': no appropriate default constructor available
1>  c:\users\damian\desktop\tfs 10.90\src\protocolgamebase.h(40): note: see declaration of 'ProtocolGameBase' (compiling source file ..\src\protocolgame.cpp)
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'Protocol' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'player' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'eventConnect' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'm_challengeTimestamp' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'version' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'm_challengeRandom' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'm_debugAssertSent' is not a base or member
1>..\src\protocolgame.cpp(54): error C2614: 'ProtocolGame': illegal member initialization: 'm_acceptPackets' is not a base or member
1>..\src\protocolgame.cpp(347): error C2509: 'onConnect': member function not declared in 'ProtocolGame'
1>  c:\users\damian\desktop\tfs 10.90\src\player.h(43): note: see declaration of 'ProtocolGame'
1>..\src\protocolgame.cpp(372): fatal error C1903: unable to recover from previous error(s); stopping compilation
1>  protocolspectator.cpp
1>..\src\protocolspectator.cpp(364): warning C4100: 'broadcast': unreferenced formal parameter
1>  protocollogin.cpp
1>..\src\protocollogin.cpp(47): warning C4100: 'version': unreferenced formal parameter
 
Last edited:
There is no official 10.9 TFS and you barely gave me any information, that is why I had to make assumptions - something that shouldn't happen in every single support thread that is made in this forum. Anyway, assuming - once again - that you're using djarek's cast system, you should have a protocolgamebase.cpp file where you will find addPlayerStats.
 
Ok sorry, I dont know there is something like "protocolgamebase.cpp" becouse in letter versions of tfs I dont have them, I changed the lines but I have this:

Code:
..\src\protocolgamebase.cpp(186): error C2065: 'creature': undeclared identifier
1>..\src\protocolgamebase.cpp(186): error C2227: left of '->getHealth' must point to class/struct/union/generic type
1>  ..\src\protocolgamebase.cpp(186): note: type is 'unknown-type'
1>..\src\protocolgamebase.cpp(186): error C2227: left of '->getMaxHealth' must point to class/struct/union/generic type
1>  ..\src\protocolgamebase.cpp(186): note: type is 'unknown-type'
1>..\src\protocolgamebase.cpp(198): error C2065: 'creature': undeclared identifier
1>..\src\protocolgamebase.cpp(198): error C2227: left of '->getMana' must point to class/struct/union/generic type
1>  ..\src\protocolgamebase.cpp(198): note: type is 'unknown-type'
1>..\src\protocolgamebase.cpp(198): error C2227: left of '->getMaxMana' must point to class/struct/union/generic type
1>  ..\src\protocolgamebase.cpp(198): note: type is 'unknown-type'
1>  protocolspectator.cpp
1>..\src\protocolspectator.cpp(364): warning C4100: 'broadcast': unreferenced formal parameter
1>  protocollogin.cpp
1>  protocolold.cpp
1>..\src\protocollogin.cpp(47): warning C4100: 'version': unreferenced formal parameter
 
Code:
msg.add<uint16_t>(std::ceil((static_cast<double>(player->getHealth()) / std::max<int32_t>(player->getPlayerInfo(PLAYERINFO_MAXHEALTH), 1)) * 100));
msg.add<uint16_t>(100);
 
Back
Top