[Plugin] YSF - kurta999's version

In YSF,cfg disable dialog protection,but it is disabled by default
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
In YSF,cfg disable dialog protection,but it is disabled by default
Did you compile yet.
Reply

A bug with a nickname check with Russian nicknames, with the getplayername function, when checked by RegEx, shows that nickname is not valid.

Regular expression -
PHP код:
"[A-Z][a-z]+_[A-Z][a-z]+|[А-Я][а-я]+_[А-Я][а-я]+" 
Ascii -
PHP код:
А 208 144 Я 208 175  || а 208 176 я 209 143 
Himself nickname -
PHP код:
Салик_Давинче 
Reply

I didn't know YSF does RegEx checks. There's nothing wrong in the pattern.
Reply

Quote:
Originally Posted by sprtik
Посмотреть сообщение
I didn't know YSF does RegEx checks. There's nothing wrong in the pattern.
I did not say that I check regex with YSF plugin, please read my message.

And in the pattern there are no mistakes, I even checked them with simple checks on the validity of Russian nicknames, and displays an error when connecting, probably when the player connects to it in nickname something happens (it is unlikely) or it is necessary to remake the function GetPlayerName, probably it is that Then when you connect the player (OnPlayerConnect) displays something that is not what or what happens.
Reply

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Did you compile yet.
I wasn't able to compile it on my Debian VPS because i wasn't able to install GCC6 on it.. I'll anyway try to find a working way for you
Reply

Hi, the current version works for me but when I compile it on my local Ubuntu, I get

Quote:

[19:35:09] Loading plugin: YSF.so
[19:35:09] Failed (plugins/YSF.so: undefined symbol: _ZTINSt6thread6_StateE)
[19:35:09] Loaded 5 plugins.

How did you fix this? Do I have to use a different OS?

I need a sligtly altered version of YSF for my server and would apreciate any help.
PS: Linking on the machine with the server is not really an option as I use a hosting service.
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
I wasn't able to compile it on my Debian VPS because i wasn't able to install GCC6 on it.. I'll anyway try to find a working way for you
Ye, still waiting.
Reply

Quote:
Originally Posted by Salik
Посмотреть сообщение
I did not say that I check regex with YSF plugin, please read my message.

And in the pattern there are no mistakes, I even checked them with simple checks on the validity of Russian nicknames, and displays an error when connecting, probably when the player connects to it in nickname something happens (it is unlikely) or it is necessary to remake the function GetPlayerName, probably it is that Then when you connect the player (OnPlayerConnect) displays something that is not what or what happens.
Kurta fix this. Link for fix GetPlayerName - FIX LINK
Reply

It's interesting.. Give me example characters which I should test.
Reply

@iLearner:
Quote:
Originally Posted by sprtik
Посмотреть сообщение
Does my compile produce the same errors?
Try this version. Or this:

For me everything is fine.
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
It's interesting.. Give me example characters which I should test.
->

Quote:
Originally Posted by Salik
Посмотреть сообщение
A bug with a nickname check with Russian nicknames, with the getplayername function, when checked by RegEx, shows that nickname is not valid.

Regular expression -
PHP код:
"[A-Z][a-z]+_[A-Z][a-z]+|[А-Я][а-я]+_[А-Я][а-я]+" 
Ascii -
PHP код:
А 208 144 Я 208 175  || а 208 176 я 209 143 
Himself nickname -
PHP код:
Салик_Давинче 
And AllChar =
PHP код:
static isRussianCharacter[] =
{
    
'А''а',    'Б''б',    'В''в',
    
'Г''г',    'Д''д',    'Е''е',
    
'Ё''ё',    'Ж''ж',    'З''з',
    
'И''и',    'Й''й',    'К''К',
    
'Л''л',    'М''м',    'Н''н',
    
'О''о',    'П''п',    'Р''р',
    
'С''с',    'Т''т',    'У''у',
    
'Ф''ф',    'Х''х',    'Ц''ц',
    
'Ч''ч',    'Ш''ш',    'Щ''щ',
    
'Ъ''ъ',    'Ы''ы',    'ь''ь',
    
'Э''э',    'Ю''ю',    'Я''я'
};
stock PreloadAllowNickCharacters() {
    for(new 
0sizeof(isRussianCharacter); i++) {
    
//
        
AllowNickNameCharacter(isRussianCharacter[i], true);
    }
    return 
true;

Russian Characters - Wikipedia
Reply

I assume you use the Windows-1251 character set. For compatibility with other users and compilers, I'd recommend writing the characters using their respective ANSI character codes, not the character themselves.
Reply

Quote:
Originally Posted by kurta999
Посмотреть сообщение
It's interesting.. Give me example characters which I should test.
Quote:
Originally Posted by sprtik
Посмотреть сообщение
I assume you use the Windows-1251 character set. For compatibility with other users and compilers, I'd recommend writing the characters using their respective ANSI character codes, not the character themselves.
I want what day I already have to explain to you that the bug is in the function GetPlayerName, probably kurta999 understood me.
Reply

Quote:
Originally Posted by Salik
Посмотреть сообщение
I want what day I already have to explain to you that the bug is in the function GetPlayerName, probably kurta999 understood me.
For some reason, GetPlayerName takes the characters in the player's name as signed bytes (someone apparently forgot unsigned char), and does sign extension to store them to the string. Thus characters with codes > 127 (all non-ASCII characters) get stored as negative values instead of values in range 0 - 255. Therefore, 'Ń' is stored as 0xFFFFFFD1 (-47) instead of 209. This produces a packed string, which is recognized by all other natives, but contains wrong characters.

Why hasn't this been spotted before? Because the packedness of a string is determined by the first character in the string, and so far all character names tested (latin with diacritics) apparently didn't start with a non-ASCII letter, thus the string was recognized as unpacked by all routines, and therefore they ignored the redundant FFFFFFs. Nice bug you've found!

Fortunately, it is possible to fix this with a simple function:
Код:
stock NormSignedCharString(string[])
{
    for(new i = 0; string[i]; i++)
    {
        string[i] &= 0xFF;
    }
}
This strips all non-character data from the string. However, it appears that this is not caused only by GetPlayerName, but possibly other functions. I have observed GetPVarString string behaving this way, too. Might be even an error in Pawn implementation.
Reply

Quote:
Originally Posted by sprtik
Посмотреть сообщение
For some reason, GetPlayerName takes the characters in the player's name as signed bytes (someone apparently forgot unsigned char), and does sign extension to store them to the string. Thus characters with codes > 127 (all non-ASCII characters) get stored as negative values instead of values in range 0 - 255. Therefore, 'Ń' is stored as 0xFFFFFFD1 (-47) instead of 209. This produces a packed string, which is recognized by all other natives, but contains wrong characters.

Why hasn't this been spotted before? Because the packedness of a string is determined by the first character in the string, and so far all character names tested (latin with diacritics) apparently didn't start with a non-ASCII letter, thus the string was recognized as unpacked by all routines, and therefore they ignored the redundant FFFFFFs. Nice bug you've found!

Fortunately, it is possible to fix this with a simple function:
Код:
stock NormSignedCharString(string[])
{
    for(new i = 0; string[i]; i++)
    {
        string[i] &= 0xFF;
    }
}
This strips all non-character data from the string. However, it appears that this is not caused only by GetPlayerName, but possibly other functions. I have observed GetPVarString string behaving this way, too. Might be even an error in Pawn implementation.
facepalm, server kicked with your fix -



The variant from Daniel_Cortez helped, but still you(kurta999) need to fix the fix in the YSF plugin.

PHP код:
FixSVarString(str[], size sizeof(str))//thx to daniel cortez
    
for (new 0; ((str[i] &= 0xFF) != '\0') && (++!= size);) {} 
Reply

Quote:
Originally Posted by Salik
Посмотреть сообщение
facepalm, server kicked with your fix -
for (new i = 0; ((str[i] &= 0xFF) != '\0') && (++i != size) {}[/php]
For no reason, the code does the same thing...
Reply

Quote:
Originally Posted by sprtik
Посмотреть сообщение
For no reason, the code does the same thing...
I also thought the same way but somewhere you made a mistake probably.
Reply

Quote:
Originally Posted by Salik
Посмотреть сообщение
Kurta fix this. Link for fix GetPlayerName - FIX LINK
It's not possible to load first yes, then this plugin? It might work anyway without touching ysf.
Reply

When will the new version of the plugin come out?

I'm dreaming times, expecting AttachedObecjts per player, and the server controlling sirens ... I have lots of ideas for them ^^
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)