RolePlay Name
#1

How can i script , when player connect by name like [Killer]David , he will kicked automatic ,and
when player connect by roleplay name like David_Hudson , he can joined to the server..

How to Script That ?

Sorry For My Bad English..
Reply
#2

Yeah I Know What you meaning , Thats Name Checking ?
Reply
#3

Fast auto non roleplay name detector and auto kicker .

Код:
public OnPlayerConnect(playerid)
{
	new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
	// Has numbers
 	if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
	|| strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1)
	{
		SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
		SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Also, please remove the numbers and/or tags in your name.");
        new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    	GetPlayerName(playerid, name, sizeof(name));
		format(string, sizeof(string), "%s has been kicked from the server for having a Non-RP name.", name);
    	SendClientMessageToAll(0xC4C4C4FF, string);
		Kick(playerid);
	}
 	// No Underscore
	if(strfind( name, "_", true) == -1)
	{
		SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
        format(string, sizeof(string), "%s has been kicked from the server for having a Non-RP name.", name);
    	SendClientMessageToAll(0xC4C4C4FF, string);
		Kick(playerid);
	}
	return 1;
}
Reply
#4

Function CheckPlayerName.
pawn Код:
stock CheckPlayerName(const name[])
{
    if (strlen(name) < 6) return 0;
    if (strfind(name, "_", true) == -1) return 0;
    new underscorecount, expectinguppercase = 1;
    for (new i = 0, j = strlen(name); i < j; i++)
    {
        if (expectinguppercase == 1)
        {
            if (name[i] < 'A' || name[i] > 'Z') return 0;
            expectinguppercase = 0;
            continue;
        }
        switch (name[i])
        {
            case '_':
            {
                if (underscorecount == 1) return 0;
                else
                {
                    underscorecount = 1;
                    expectinguppercase = 1;
                }
                continue;
            }
            case 'A' .. 'Z': continue;
            case 'a' .. 'z': continue;
            default: return 0;
        }
    }
    return 1;
}
}
Reply
#5

Quote:
Originally Posted by JeevanJyothish
Посмотреть сообщение
Fast auto non roleplay name detector and auto kicker .

Код:
public OnPlayerConnect(playerid)
{
	new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, name, sizeof(name));
	// Has numbers
 	if(strfind(name, "0", true) != -1 || strfind(name, "1", true) != -1 || strfind(name, "2", true) != -1 || strfind(name, "3", true) != -1 || strfind(name, "4", true) != -1 || strfind(name, "5", true) != -1
	|| strfind(name, "6", true) != -1 || strfind(name, "7", true) != -1 || strfind(name, "8", true) != -1 || strfind(name, "9", true) != -1 || strfind(name, "[", true) != -1 || strfind(name, "]", true) != -1)
	{
		SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
		SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}Also, please remove the numbers and/or tags in your name.");
        new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
    	GetPlayerName(playerid, name, sizeof(name));
		format(string, sizeof(string), "%s has been kicked from the server for having a Non-RP name.", name);
    	SendClientMessageToAll(0xC4C4C4FF, string);
		Kick(playerid);
	}
 	// No Underscore
	if(strfind( name, "_", true) == -1)
	{
		SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}This is a RP Server, please reconnect using Firstname_Lastname format.");
        format(string, sizeof(string), "%s has been kicked from the server for having a Non-RP name.", name);
    	SendClientMessageToAll(0xC4C4C4FF, string);
		Kick(playerid);
	}
	return 1;
}
Thanks Man
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)