Player name with "_"
#1

Hellow, how to change this ? I want to cant create a normal name without "_" Like : Sn4Ke, or NiTr3X, here is the code

PHP код:
Dialog:CreateChar(playeridresponselistiteminputtext[])
{
    if (!
response)
        return 
PlayerData[playerid][pCharacter] = 0;
    else if (
isnull(inputtext) || strlen(inputtext) > 20)
        return 
Dialog_Show(playeridCreateCharDIALOG_STYLE_INPUT"Create Character""Please enter the name of your new character below:\n\nWarning: Your name must be in the Firstname_Lastname format and not exceed 20 characters.""Create""Cancel");
    else if (!
IsValidRoleplayName(inputtext))
        return 
Dialog_Show(playeridCreateCharDIALOG_STYLE_INPUT"Create Character""Error: You have entered an invalid roleplay name.\n\nPlease enter the name of your new character below:\n\nWarning: Your name must be in the Firstname_Lastname format and not exceed 20 characters.""Create""Cancel");
    else
    {
        static
            
query[128];
        
format(querysizeof(query), "SELECT `ID` FROM `characters` WHERE `Character` = '%s'"inputtext);
        
mysql_tquery(g_iHandlequery"OnCharacterCheck""ds"playeridinputtext);
    }
    return 
1;

And Public
PHP код:
IsValidRoleplayName(const name[]) {
    if (!
name[0] || strfind(name"_") == -1)
        return 
0;
    else for (new 
0len strlen(name); != len++) {
        if ((
== 0) && (name[i] < 'A' || name[i] > 'Z'))
            return 
0;
        else if ((
!= && len  && name[i] == '_') && (name[1] < 'A' || name[1] > 'Z'))
            return 
0;
        else if ((
name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z') && name[i] != '_' && name[i] != '.')
            return 
0;
    }
    return 
1;

Reply


Messages In This Thread
Player name with "_" - by Sn4ke2 - 28.08.2015, 07:57
Re: Player name with "_" - by PT - 28.08.2015, 08:17
Re: Player name with "_" - by Sn4ke2 - 28.08.2015, 08:40
Re: Player name with "_" - by Banana_Ghost - 29.08.2015, 15:55

Forum Jump:


Users browsing this thread: 1 Guest(s)