bad nickname
#1

i need some code or filterscript if player dont have RP nickname

if he have Name_Surename he can play

everything else get kick

anyone know some script for this?
Reply
#2

if oyu search you gonna find about 50 thread which will help you
Reply
#3

Use this.

Код:
        new namestring = strfind(plname, "_", true);
 	if(namestring == -1)
	{
            SendClientMessage(playerid, colorid, "Your name must be in the Name_Surname format.");
            Kick(playerid);
	    return 1;
	}
Reply
#4

dude i search i dont find nothing i find something like

nick_nick kick
if dont have _ kick


but kick evrything except Nick_Nick i dont find
Reply
#5

Here is one realy badass non RP name Kicker

It kicks, who dont have _ in name, name lenght shorter than 6, if there will any number, or wont be name first letter capital and surname first letter capital.

pawn Код:
new username[24];
    GetPlayerName(playerid,username,sizeof(username));
    new name1 = strfind(username, "kill", true);
    new name2 = strfind(username, "__", true);
    new name3 = strfind(username, "123", true);
    new name4 = strfind(username, "asd", true);
    new name5 = strfind(username, "xx", true);
    if(name1 != -1 || name2 != -1 || name3 != -1 || name4 != -1 || name5 != -1)
    {
        SendClientMessage(playerid,COLOR_WARN,"WARNING: You don't have valid Role Play Name, in SA:MP client change it to right format: Name_Surname.");
        Kick(playerid);
        return 1;
    }
pawn Код:
IsValidRPName(rpname[])
{
    if(strfind(rpname,"_",true) == -1) { return 0; }
    if(strlen(rpname) < 6) { return 0; }
    new pos;
    while(pos <= strlen(rpname))
    {
        new str[5];
        for(new lenght = 0; lenght < 10; lenght++)
        {
            format(str,sizeof(str),"%d",lenght);
            if(strfind(rpname[pos],str,true) != -1)
            {
                return 0;
            }
        }
        pos++;
    }
    new part[2][12];
    new name,surname;
    split(rpname,part,'_');
    if(part[0][0] >= 'A' && part[0][0] <= 'Z')
    {
        name = 1;
    }
    if(part[1][0] >= 'A' && part[1][0] <= 'Z')
    {
        surname = 1;
    }
    if(name == 1 && surname == 1)
    {
        return 1;
    }
    else
    {
        return 0;
    }
}
Example
pawn Код:
if(!IsValidRPName(username))
    {
        SendClientMessage(playerid,COLOR_WARN,"WARNING: You don't have valid Role Play Name, in SA:MP client change it to right format: Name_Surname.");
        Kick(playerid);
        return 1;
    }
Reply
#6

Just wrote that as improved version of the above code now
- Each name must start with a capital and go on with lower case letters
- Names are separted with underscores
- No limit with names, means "Don_Fernando_Flores" as example is valid

pawn Код:
stock IsValidRPName(name[])
{ //Nero_3D © 12.2010
    new idx = strfind(name, "_", false);
    if((idx != -1) && ('A' <= name[0] <= 'Z') && ('A' <= name[idx + 1] <= 'Z')) {
        new i = 1;
        while(i != idx) {
            switch(name[i]) {
                case 'a'..'z': i++;
                default: return 0;
            }
        }
        for(i += 2; ; ) {
            switch(name[i]) {
                case 'a'..'z': i++;
                case '_': return IsValidRPName(name[idx + 1]);
                case EOS: return 1;
                default: return 0;
            }
        }
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)