Dialog Respond
#1

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new str[256];
    if (dialogid == 911)
    {
        if(response)
        {
            if(Warn[playerid] >= 2)
            {
                KickWithMessage(playerid, COLOR_RED, "Good bye!");
                return 1;
            }
            if(!strlen(inputtext))
            {
                Warn[playerid] += 1;
                format(str, sizeof(str),"Los Entertainment Multimod\t\tIP::~~~~~\nIt seems like you do not have\n a roleplay name please pick one. \n\n {CC0000}You was warned for not entering text! {FFFFFF}\nWARNS: %d/3",Warn[playerid]);
                ShowPlayerDialog(playerid, 911, DIALOG_STYLE_INPUT, "{CC0000}Please Enter a suitable roleplay name roleplay name",str, "Register", "Cancel");
                return 1;
            }
            if(!RPname(playerid))
            {
                Warn[playerid] += 1;
                format(str, sizeof(str),"Los Entertainment Multimod\t\tIP::~~~~~\nIt seems like you do not have\n a roleplay name please pick one. \n\n {CC0000}You was warned for not picking a proper roleplay name! {FFFFFF}\nWARNS: %d/3",Warn[playerid]);
                ShowPlayerDialog(playerid, 911, DIALOG_STYLE_INPUT, "{CC0000}Please Enter a suitable roleplay name roleplay name",str, "Register", "Cancel");
                SendClientMessage(playerid,COLOR_RED,"HINT: Your name must be in Firstname_Lastname format, For example Jason_Brown.");
            }
            else
            {
                SetPlayerName(playerid,(inputtext));
            }
        }
        else
        {
            KickWithMessage(playerid, COLOR_RED, "Good bye!");
        }
        return 1;
    }
    return 0;
}
pawn Код:
stock RPname(playerid)
{
    new pname[MAX_PLAYER_NAME],underline=0;
    GetPlayerName(playerid, pname, sizeof(pname));
    if(strfind(pname,"[",true) != (-1)) return 0;
    else if(strfind(pname,"]",true) != (-1)) return 0;
    else if(strfind(pname,"$",true) != (-1)) return 0;
    else if(strfind(pname,"(",true) != (-1)) return 0;
    else if(strfind(pname,")",true) != (-1)) return 0;
    else if(strfind(pname,"=",true) != (-1)) return 0;
    else if(strfind(pname,"@",true) != (-1)) return 0;
    else if(strfind(pname,"1",true) != (-1)) return 0;
    else if(strfind(pname,"2",true) != (-1)) return 0;
    else if(strfind(pname,"3",true) != (-1)) return 0;
    else if(strfind(pname,"4",true) != (-1)) return 0;
    else if(strfind(pname,"5",true) != (-1)) return 0;
    else if(strfind(pname,"6",true) != (-1)) return 0;
    else if(strfind(pname,"7",true) != (-1)) return 0;
    else if(strfind(pname,"8",true) != (-1)) return 0;
    else if(strfind(pname,"9",true) != (-1)) return 0;
    else if(strfind(pname,"fuck",true) != (-1)) return 0;
    else if(strfind(pname,"FUCK",true) != (-1)) return 0;
    else if(strfind(pname,"Boobies",true) != (-1)) return 0;
    else if(strfind(pname,"Tupac_Shakur",true) != (-1)) return 0;
    else if(strfind(pname,"Pussy",true) != (-1)) return 0;
    else if(strfind(pname,"Rape",true) != (-1)) return 0;
    else if(strfind(pname,"kill",true) != (-1)) return 0;
    else if(strfind(pname,"shit",true) != (-1)) return 0;
    else if(strfind(pname,"ass",true) != (-1)) return 0;
    else if(strfind(pname,"Jack_Black",true) != (-1)) return 0;
    else if(strfind(pname,"Max_Kenton",true) != (-1)) return 0;
    else if(strfind(pname,"Will_Smith",true) != (-1)) return 0;
    else if(strfind(pname,"Jaden_Smith",true) != (-1)) return 0;
    else if(strfind(pname,"Megan_Fox",true) != (-1)) return 0;
    else if(strfind(pname,"Charlie_Kenton",true) != (-1)) return 0;
    else if(strfind(pname,"Hugh_Hefner",true) != (-1)) return 0;
    else if(strfind(pname,"Paris_Hilton",true) != (-1)) return 0;
    else if(strfind(pname,"Marshall_Mathers",true) != (-1)) return 0;
    else if(strfind(pname,"Sheldon_Cooper",true) != (-1)) return 0;
    else if(strfind(pname,"Jet_Lee",true) != (-1)) return 0;
    else if(strfind(pname,"Jackie_Chan",true) != (-1)) return 0;
    else if(strfind(pname,"Chuck_Norris",true) != (-1)) return 0;
    else if(strfind(pname,"Peter_Parker",true) != (-1)) return 0;
    else if(strfind(pname,"Spider_Man",true) != (-1)) return 0;
    else if(strfind(pname,"Bat_Man",true) != (-1)) return 0;
    else if(strfind(pname,"Emma_Stone",true) != (-1)) return 0;
    else if(strfind(pname,"whore",true) != (-1)) return 0;
    else if(strfind(pname,"Hugh_Jackman",true) != (-1)) return 0;
    else if(strfind(pname,"Charles_Kenton",true) != (-1)) return 0;
    else if(strfind(pname,"Harry_Potter",true) != (-1)) return 0;
    else if(strfind(pname,"Chris_Hemsworth",true) != (-1)) return 0;
    else if(strfind(pname,"Penis",true) != (-1)) return 0;
    else if(strfind(pname,"_Dick",true) != (-1)) return 0;
    else if(strfind(pname,"Vagina",true) != (-1)) return 0;
    else if(strfind(pname,"Cock",true) != (-1)) return 0;
    else if(strfind(pname,"Rectum",true) != (-1)) return 0;
    else if(strfind(pname,"Sperm",true) != (-1)) return 0;
    else if(strfind(pname,"Rektum",true) != (-1)) return 0;
    else if(strfind(pname,"Pistol",true) != (-1)) return 0;
    else if(strfind(pname,"AK47",true) != (-1)) return 0;
    else if(strfind(pname,"Shotgun",true) != (-1)) return 0;
    else if(strfind(pname,"Cum",true) != (-1)) return 0;
    else if(strfind(pname,"Hitler",true) != (-1)) return 0;
    else if(strfind(pname,"Jesus",true) != (-1)) return 0;
    else if(strfind(pname,"God",true) != (-1)) return 0;
    else if(strfind(pname,"Shotgun",true) != (-1)) return 0;
    else if(strfind(pname,"Desert_Eagle",true) != (-1)) return 0;
    else if(strfind(pname,"fucker",true) != (-1)) return 0;
    else if(strfind(pname,"Retard",true) != (-1)) return 0;
    else if(strfind(pname,"Tarded",true) != (-1)) return 0;
    else if(strfind(pname,"fanny",true) != (-1)) return 0;
    else if(strfind(pname,"Daniel_Hardy",true) != (-1)) return 0;
    else if(strfind(pname,"abcdefghijklmnopqrstuvwxyz",true) != (-1)) return 0;
    new maxname = strlen(pname);
    for(new i=0; i<maxname; i++)
    {
       if(pname[i] == '_') underline ++;
    }
    if(underline != 1) return 0;
    pname[0] = toupper(pname[0]);
    for(new x=1; x<maxname; x++)
    {
        if(pname[x] == '_') pname[x+1] = toupper(pname[x+1]);
        else if(pname[x] != '_' && pname[x-1] != '_') pname[x] = tolower(pname[x]);
    }
    SetPlayerName(playerid, "New_Name");
    SetPlayerName(playerid, pname);
    return 1;
}
When player enters a proper name Firstname_Lastname it still warns him instead of change his name..
Reply
#2

Well than it is the fault of the RPname function if you get a warning after entering a valid name
Reply
#3

WEll it was working before I added if(Warn... and if(!stren..

pawn Код:
stock RPname(playerid)
{
    new pname[MAX_PLAYER_NAME],underline=0;
    GetPlayerName(playerid, pname, sizeof(pname));
    if(strfind(pname,"[",true) != (-1)) return 0;
    else if(strfind(pname,"]",true) != (-1)) return 0;
    else if(strfind(pname,"$",true) != (-1)) return 0;
    else if(strfind(pname,"(",true) != (-1)) return 0;
    else if(strfind(pname,")",true) != (-1)) return 0;
    else if(strfind(pname,"=",true) != (-1)) return 0;
    else if(strfind(pname,"@",true) != (-1)) return 0;
    else if(strfind(pname,"1",true) != (-1)) return 0;
    else if(strfind(pname,"2",true) != (-1)) return 0;
    else if(strfind(pname,"3",true) != (-1)) return 0;
    else if(strfind(pname,"4",true) != (-1)) return 0;
    else if(strfind(pname,"5",true) != (-1)) return 0;
    else if(strfind(pname,"6",true) != (-1)) return 0;
    else if(strfind(pname,"7",true) != (-1)) return 0;
    else if(strfind(pname,"8",true) != (-1)) return 0;
    else if(strfind(pname,"9",true) != (-1)) return 0;
    else if(strfind(pname,"fuck",true) != (-1)) return 0;
    else if(strfind(pname,"FUCK",true) != (-1)) return 0;
    else if(strfind(pname,"Boobies",true) != (-1)) return 0;
    else if(strfind(pname,"Tupac_Shakur",true) != (-1)) return 0;
    else if(strfind(pname,"Pussy",true) != (-1)) return 0;
    else if(strfind(pname,"Rape",true) != (-1)) return 0;
    else if(strfind(pname,"kill",true) != (-1)) return 0;
    else if(strfind(pname,"shit",true) != (-1)) return 0;
    else if(strfind(pname,"ass",true) != (-1)) return 0;
    else if(strfind(pname,"Jack_Black",true) != (-1)) return 0;
    else if(strfind(pname,"Max_Kenton",true) != (-1)) return 0;
    else if(strfind(pname,"Will_Smith",true) != (-1)) return 0;
    else if(strfind(pname,"Jaden_Smith",true) != (-1)) return 0;
    else if(strfind(pname,"Megan_Fox",true) != (-1)) return 0;
    else if(strfind(pname,"Charlie_Kenton",true) != (-1)) return 0;
    else if(strfind(pname,"Hugh_Hefner",true) != (-1)) return 0;
    else if(strfind(pname,"Paris_Hilton",true) != (-1)) return 0;
    else if(strfind(pname,"Marshall_Mathers",true) != (-1)) return 0;
    else if(strfind(pname,"Sheldon_Cooper",true) != (-1)) return 0;
    else if(strfind(pname,"Jet_Lee",true) != (-1)) return 0;
    else if(strfind(pname,"Jackie_Chan",true) != (-1)) return 0;
    else if(strfind(pname,"Chuck_Norris",true) != (-1)) return 0;
    else if(strfind(pname,"Peter_Parker",true) != (-1)) return 0;
    else if(strfind(pname,"Spider_Man",true) != (-1)) return 0;
    else if(strfind(pname,"Bat_Man",true) != (-1)) return 0;
    else if(strfind(pname,"Emma_Stone",true) != (-1)) return 0;
    else if(strfind(pname,"whore",true) != (-1)) return 0;
    else if(strfind(pname,"Hugh_Jackman",true) != (-1)) return 0;
    else if(strfind(pname,"Charles_Kenton",true) != (-1)) return 0;
    else if(strfind(pname,"Harry_Potter",true) != (-1)) return 0;
    else if(strfind(pname,"Chris_Hemsworth",true) != (-1)) return 0;
    else if(strfind(pname,"Penis",true) != (-1)) return 0;
    else if(strfind(pname,"_Dick",true) != (-1)) return 0;
    else if(strfind(pname,"Vagina",true) != (-1)) return 0;
    else if(strfind(pname,"Cock",true) != (-1)) return 0;
    else if(strfind(pname,"Rectum",true) != (-1)) return 0;
    else if(strfind(pname,"Sperm",true) != (-1)) return 0;
    else if(strfind(pname,"Rektum",true) != (-1)) return 0;
    else if(strfind(pname,"Pistol",true) != (-1)) return 0;
    else if(strfind(pname,"AK47",true) != (-1)) return 0;
    else if(strfind(pname,"Shotgun",true) != (-1)) return 0;
    else if(strfind(pname,"Cum",true) != (-1)) return 0;
    else if(strfind(pname,"Hitler",true) != (-1)) return 0;
    else if(strfind(pname,"Jesus",true) != (-1)) return 0;
    else if(strfind(pname,"God",true) != (-1)) return 0;
    else if(strfind(pname,"Shotgun",true) != (-1)) return 0;
    else if(strfind(pname,"Desert_Eagle",true) != (-1)) return 0;
    else if(strfind(pname,"fucker",true) != (-1)) return 0;
    else if(strfind(pname,"Retard",true) != (-1)) return 0;
    else if(strfind(pname,"Tarded",true) != (-1)) return 0;
    else if(strfind(pname,"fanny",true) != (-1)) return 0;
    else if(strfind(pname,"Daniel_Hardy",true) != (-1)) return 0;
    else if(strfind(pname,"abcdefghijklmnopqrstuvwxyz",true) != (-1)) return 0;
    new maxname = strlen(pname);
    for(new i=0; i<maxname; i++)
    {
       if(pname[i] == '_') underline ++;
    }
    if(underline != 1) return 0;
    pname[0] = toupper(pname[0]);
    for(new x=1; x<maxname; x++)
    {
        if(pname[x] == '_') pname[x+1] = toupper(pname[x+1]);
        else if(pname[x] != '_' && pname[x-1] != '_') pname[x] = tolower(pname[x]);
    }
    SetPlayerName(playerid, "New_Name");
    SetPlayerName(playerid, pname);
    return 1;
}
Reply
#4

Help please
Reply
#5

The problem is that the function RPname only checks the current name of the player but you wanted to check the input

If you don't want to change the function you could set the name of the player before RPname
pawn Код:
SetPlayerName(playerid, inputtext);
if(!RPname(playerid))
Reply
#6

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
The problem is that the function RPname only checks the current name of the player but you wanted to check the input

If you don't want to change the function you could set the name of the player before RPname
pawn Код:
SetPlayerName(playerid, inputtext);
if(!RPname(playerid))
Tested it quickly and it's working, thank you rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)