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

AAC MyAcc - maximum 3 words nickname.

OTcreator

Active Member
Joined
Feb 14, 2022
Messages
425
Solutions
1
Reaction score
44
Hi,
I suspect that this problem may be experienced by quite a few people.
In MyAcc, you can make a nickname with a length of, say, 5 words.

I've noticed that if it's over 3 words, the script that gives items from the item shop doesn't send them to that character because the nickname is too long.

How to limit the number of words in MyAcc for a nickname?
Alternatively, a fix for the globalevents script.
 
Last edited:
Solution
Just add this before returning true at the end of the function:
PHP:
$words = explode(' ', trim($name));
if(count($words) > 3){
    self::$lastError = 'Invalid name format. Use only three or less words in your name.';
    return false;
}

However, your issue is not related to the number of words, just the length of the total name, regardless of spaces. Why is the script limiting the name, and if the name is limited due to a database table (which I doubt), you only need to increase the size of the database column that stores the name, but it should be storing player id really... not a name.
Does it happen after specific nickname length? Or just after x words?

Maximum length for a name can be set here: myaac/system/libs/validator.php at master · slawkens/myaac (https://github.com/slawkens/myaac/blob/master/system%2Flibs%2Fvalidator.php#L182)

I know where set min and maximum letters (in config.lua is the same).
But how set maximum WORDS not letters.

If player have nick with 3 words etc. Lee Oga Bena - all working good, but when whoes set nick name 4 words: Ale Mana Mi Spada , not working. Shop not realized orders.
 
Just add this before returning true at the end of the function:
PHP:
$words = explode(' ', trim($name));
if(count($words) > 3){
    self::$lastError = 'Invalid name format. Use only three or less words in your name.';
    return false;
}

However, your issue is not related to the number of words, just the length of the total name, regardless of spaces. Why is the script limiting the name, and if the name is limited due to a database table (which I doubt), you only need to increase the size of the database column that stores the name, but it should be storing player id really... not a name.
 
Solution
Just add this before returning true at the end of the function:
PHP:
$words = explode(' ', trim($name));
if(count($words) > 3){
    self::$lastError = 'Invalid name format. Use only three or less words in your name.';
    return false;
}

However, your issue is not related to the number of words, just the length of the total name, regardless of spaces. Why is the script limiting the name, and if the name is limited due to a database table (which I doubt), you only need to increase the size of the database column that stores the name, but it should be storing player id really... not a name.

But the database showed his full name and the items were not delivered.
Later, for a test, I made myself another character for 5 words and the same thing continued.
For smaller amounts of words it was ok and items were arriving.
In addition, players can use a character for example ' - I would also like to block this.
 
But the database showed his full name and the items were not delivered.
Later, for a test, I made myself another character for 5 words and the same thing continued.
For smaller amounts of words it was ok and items were arriving.
In addition, players can use a character for example ' - I would also like to block this.
Can you post the global event script. The PHP code I provided will prohibit character names above 3 words.
 
Can you post the global event script. The PHP code I provided will prohibit character names above 3 words.
Post automatically merged:

Just add this before returning true at the end of the function:
PHP:
$words = explode(' ', trim($name));
if(count($words) > 3){
    self::$lastError = 'Invalid name format. Use only three or less words in your name.';
    return false;
}

However, your issue is not related to the number of words, just the length of the total name, regardless of spaces. Why is the script limiting the name, and if the name is limited due to a database table (which I doubt), you only need to increase the size of the database column that stores the name, but it should be storing player id really... not a name.

Where I must add this? I use MyACC.
 
Last edited:
Post automatically merged:



Where I must add this? I use MyACC.
He already gave you the link that contains the file and line number.
Just append the code I wrote before returning true at the end of the method.

If you don't have that version of myaac, then you need to figure out where in the system, it does a name check, which will probably be similarly to what is above, even in an earlier version.
 
I seem to recall running into an issue like this previously where for some reason the names were being interpreted with a double space between the second and third words. Unfortunately I don't remember what was done about it, but I'd check if that is what is occurring here too.
From memory, this resulted in exiva/parcels/vip/pm also not functioning properly for those players (I think it worked if you added the double space though). It was particularly interesting because in the database the names were saved correctly. TFS was doing something weird with the names.
 
I seem to recall running into an issue like this previously where for some reason the names were being interpreted with a double space between the second and third words. Unfortunately I don't remember what was done about it, but I'd check if that is what is occurring here too.
From memory, this resulted in exiva/parcels/vip/pm also not functioning properly for those players (I think it worked if you added the double space though). It was particularly interesting because in the database the names were saved correctly. TFS was doing something weird with the names.
Yup, seen it happen with parcels myself. Add an extra space at the end of the recipients's name, and TFS will do an existence check that passes, however the player does not receive the parcel. So it seems that there is some weird string manipulation or lack of string operations such as trimming etc.

I must say though, most of this strange stuff occured with linux ofc. I think windows is a lot more lenient at runtime and seems to not have any of these issues.

But it's always best to check lua scripts first.....just incase the error resides there (bad logic/string manipulations) :p
 
Last edited:
I seem to recall running into an issue like this previously where for some reason the names were being interpreted with a double space between the second and third words. Unfortunately I don't remember what was done about it, but I'd check if that is what is occurring here too.
From memory, this resulted in exiva/parcels/vip/pm also not functioning properly for those players (I think it worked if you added the double space though). It was particularly interesting because in the database the names were saved correctly. TFS was doing something weird with the names.

Yup, happens with things like parcels too. Add an extra space at the end of the recipients's name, and TFS will do an existence check that passes, however the player does not receive the parcel. So it seems that there is some weird string manipulation or lack of string operations such as trimming etc.

But it's always best to check scripts first.....just incase :p

I used clean tfs 1.4.2.
Possible global bug ?

[UPDATE] - Parcels and Exiva working good.
 
Last edited:
Just add this before returning true at the end of the function:
PHP:
$words = explode(' ', trim($name));
if(count($words) > 3){
    self::$lastError = 'Invalid name format. Use only three or less words in your name.';
    return false;
}

However, your issue is not related to the number of words, just the length of the total name, regardless of spaces. Why is the script limiting the name, and if the name is limited due to a database table (which I doubt), you only need to increase the size of the database column that stores the name, but it should be storing player id really... not a name.

This working, thank you.
 
Back
Top