[FilterScript] Roleplay Name Checker [Advanced]
#1

Hi guys, I decided to make my roleplay name checker for my server as a filterscript and release it for you guys. The roleplay name checker currently detects the following:
  • Anti-Swears in name, This allow's no swear words to be in name accept Dick which can only be part of the First name.
  • Anti-Famous name, This detects wether a player is using a common famous name such as Chuck_Norris, Marshall_Mathers, Max_Kenton etc and if they are it will force them to change there name.
  • Anti-Weapon in name, You can't have a commonly used weapon in your name such as Desert Eagle, Ak47 etc.
  • Feature which will force them to change there name on connet.
code
pawn Code:
#define FILTERSCRIPT

#include <a_samp>

#define COLOR_RED       0xFF0000AA

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Roleplay Name Detector by Jueix");
    print("--------------------------------------\n");
    return 1;
}

stock RPnamecheck(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;
}

public OnPlayerConnect(playerid)
{
    //dealership
    //login system
    if(!RPnamecheck(playerid)) {
            ShowPlayerDialog(playerid, 911, DIALOG_STYLE_INPUT, "{CC0000}Please Enter a suitable roleplay name roleplay name", "Los Entertainment Multimod\t\t\t\tIP::~~~~~\nIt seems like you do not have a roleplay name please pick one.(No Famous Names Got a good Anti-detect for that).", "Register", "Cancel");
            SendClientMessage(playerid,COLOR_RED,"HINT: Your name must be in Firstname_Lastname format, For example Jason_Brown.");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 911)
    {
        SetPlayerName(playerid,(inputtext));
        if(!RPnamecheck(playerid)) {
            ShowPlayerDialog(playerid, 911, DIALOG_STYLE_INPUT, "{CC0000}Please Enter a suitable roleplay name roleplay name", "Los Entertainment Multimod\t\t\t\tIP::~~~~~\nIt seems like you do not have a roleplay name please pick one.(No Famous Names Got a good Anti-detect for that).", "Register", "Cancel");
            SendClientMessage(playerid,COLOR_RED,"HINT: Your name must be in Firstname_Lastname format, For example Jason_Brown.");
        }
        else
        {
            SetPlayerName(playerid,(inputtext));
        }
    }
}


public OnFilterScriptExit()
{
    return 1;
}
Download

pastebin: http://pastebin.com/wpudSJMc

Thank's guys.

Please post famous name's or swear words or things you don't want players names to be below and i will add them to the script.
Reply
#2

Good job .
Reply
#3

Nice
Reply
#4

Very useful 10/10
Reply
#5

Nice effort, well done
Reply
#6

Very good.
+Rep
Reply
#7

Saved me a job!
Reply
#8

How about you put all those names in a file? Those elseif statements are a pain to my eyes.
Reply
#9

Or just check if the player doesn't have an underscore..?
Reply
#10

good work,
nice....
Reply
#11

Hi. I saved this, but my register from my GM won\'t let FS doing his job.
Reply
#12

Quote:
Originally Posted by Zeus666
View Post
Hi. I saved this, but my register from my GM won\'t let FS doing his job.
Why are you using such an old and bad method of checking RP names ? Plus bumping old threads


Here: http://forum.sa-mp.com/showpost.php?...postcount=4570
Reply
#13

pawn Code:
// ** INCLUDES

#include <a_samp>

// ** DEFINES

// *** ROLEPLAY NAME TYPES

#define ROLEPLAY_NAME_FALSE 0
#define ROLEPLAY_NAME_TRUE 1
#define ROLEPLAY_NAME_UNCAPPED 2
#define ROLEPLAY_NAME_CONTAINS_NUMBERS 3

// ** MAIN

main()
{
    print("Loaded \"rp_name_detector.amx\".");

    switch(IsRoleplayName("Test_Test"))
    {
        case ROLEPLAY_NAME_FALSE:
        {
            print("Name is not a roleplay name.");
        }
        case ROLEPLAY_NAME_TRUE:
        {
            print("Name is a roleplay name.");
        }
        case ROLEPLAY_NAME_UNCAPPED:
        {
            print("Name is uncapped.");
        }
        case ROLEPLAY_NAME_CONTAINS_NUMBERS:
        {
            print("Name can\'t contain numbers.");
        }
    }
}

// ** CALLBACKS

public OnGameModeInit()
{  
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

// ** FUNCTIONS

stock IsRoleplayName(player_name[])
{
    for(new i = 0, j = strlen(player_name); i < j; i ++)
    {
        switch(player_name[i])
        {
            case \'0\'..\'9\':
            {
                return ROLEPLAY_NAME_CONTAINS_NUMBERS;
            }
        }
    }

    if(65 <= player_name[0] <= 90)
    {
        new underscore_1 = strfind(player_name, "_");
        if(underscore_1 >= 3)
        {
            if(65 <= player_name[underscore_1 + 1] <= 90)
            {
                if(strfind(player_name, "_", false, (underscore_1 + 1)) == -1)
                {
                    if(((strlen(player_name) - underscore_1) - 1) >= 3)
                    {
                        return ROLEPLAY_NAME_TRUE;
                    }
                }
            }
            else
            {
                if(((strlen(player_name) - underscore_1) - 1) <= 2)
                {
                    return ROLEPLAY_NAME_FALSE;
                }
                else
                {
                    return ROLEPLAY_NAME_UNCAPPED;
                }
            }
        }
    }
    else
    {
        if(strfind(player_name, "_") <= 3)
        {
            return ROLEPLAY_NAME_FALSE;
        }
        else
        {
            return ROLEPLAY_NAME_UNCAPPED;
        }
    }
    return ROLEPLAY_NAME_FALSE;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)