INVALID NICK.
#5

pawn Код:
stock InvalidNickKick(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,sizeof(name));
    new where = strfind(name,"_",true);
    new lenght = strlen(name)-1;
    if(where == 0 || where == lenght || where==-1)
    {
        SendClientMessage(playerid,COLOR_ORANGE,"* SERVER: Name_Lastname");
        Kick(playerid);
        return 1;
    }
    if(where<3)
    {
        SendClientMessage(playerid,COLOR_ORANGE,"* SERVER: your firstname is too short");
        Kick(playerid);
        return 1;
    }
    if(length-where<4)
    {
        SendClientMessage(playerid,COLOR_ORANGE,"* SERVER: your lastname is too short");
        Kick(playerid);
        return 1;
    }
    new bool:invalid = false;

    if(strfind(name,"[",true,0) != -1|| strfind(name,"]",true,0)!= -1)invalid = true;
   
    if(invalid == true)
    {
        SendClientMessage(playerid,COLOR_ORANGE,"* SERVER: invalids letters in your name");
        Kick(playerid);
        return 1;
    }
   
/* Use this if you want to get first and last name.
new fName[20],lName[20];
    for(new i=0;name[i]!='_';++i)
    {
        fName[i] = name[i];
    }
   
    new j=0;
    for(new i = where+1;name[i]!='\0';++i,++j)
    {
        lName[j] = name[i];
    }
*/

    return 0;
}
Reply


Messages In This Thread
INVALID NICK. - by budelis - 21.07.2012, 12:39
Re: INVALID NICK. - by budelis - 21.07.2012, 14:49
Re: INVALID NICK. - by Derelict - 21.07.2012, 16:42
Re: INVALID NICK. - by budelis - 22.07.2012, 14:16
Re: INVALID NICK. - by [MM]RoXoR[FS] - 22.07.2012, 14:36

Forum Jump:


Users browsing this thread: 1 Guest(s)