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

Fix/Patch Exiva long names on TFS 1.x

hodleo

Formerly cbrm -Crypto enthusiast, Retired scripter
Staff member
Global Moderator
Joined
Jan 6, 2009
Messages
6,598
Solutions
3
Reaction score
955
Location
Caribbean Sea
According to Tibia, the limit of characters in the player's name is 29. If you try to cast exiva on names longer than 20 characters in TFS 1.x it simply doesn't work or tells you player isn't online. This quick workaround fixed it and it might be useful for those who allow players to have long character names. Dunno if there's repercussions on changing those default values, but tests have gone all fine.

sources/game.cpp
Change
Code:
if (strlen == 0 || strlen > 20) {
For
Code:
if (strlen == 0 || strlen > 29) {

sources/spells.cpp
Change
Code:
Player* playerExiva = g_game.getPlayerByName(param);
For
Code:
Player* playerExiva = nullptr;
g_game.getPlayerByNameWildcard(param, playerExiva);
 
Thank you mate, I have been looking for this for some weeks ago.
 
whats the difference using nullptr?
It didn't work with getPlayerByName, but instead with getPlayerByNameWildcard.
That last one requires a variable to store its output data, I just copied a similar code near those lines that initially sets a null var. in case it doesn't find the player.

Tho I don't know if the strlen affects the original function.
 
It didn't work with getPlayerByName, but instead with getPlayerByNameWildcard.
That last one requires a variable to store its output data, I just copied a similar code near those lines that initially sets a null var. in case it doesn't find the player.

Tho I don't know if the strlen affects the original function.
thanks u for explaining me
 
Back
Top