• 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!

Compiling [TFS 1.2] add sign (-) before number attack

Scrappy Coco

Member
Joined
Dec 27, 2014
Messages
95
Reaction score
17
hello anyone knows how to add this sign ( -) before the number of damage created by an attacker
i am use tfs 1.2
example:
andm51.png


Thanks for your time and sorry for my bad english
 
https://github.com/otland/forgottenserver/blob/master/src/protocolgame.cpp#L1303-L1334

Code:
msg.add<uint32_t>(message.primary.value);

It's uint32_t, you can't send negative values.
Its just a question, because C++ is not a strong point.

Isn't msg.add a template and it's size is based on its cast type, even if it is not doesn't both signed and unsigned use the same number of bytes?

If this is the case, in theory casting message.primary.value to int32_t while multiplying by -1 would allow the use of negative values, of course this would put a cap on the minimum values used due to the limited range of int32_t in comparison of the maximum range of uint32_t.
Code:
msg.add<int32_t>(message.primary.value * -1);
 
Last edited:
The client will parse whatever value you pass to the packet as an unsigned value. You cannot change the type through the network protocol.
Using int32_t instead of uint32_t will just result in some funky value or a debug.
 
The client will parse whatever value you pass to the packet as an unsigned value. You cannot change the type through the network protocol.
Using int32_t instead of uint32_t will just result in some funky value or a debug.
Thanks for the response and clarification.
 
Back
Top