[FilterScript] Roleplay Name Checker [Advanced]
#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


Messages In This Thread
Roleplay Name Checker [Advanced] - by jueix - 25.02.2013, 11:09
Re: Roleplay Name Checker [Advanced] - by Immortal_LTU - 26.02.2013, 13:10
Re: Roleplay Name Checker [Advanced] - by oLfacTiv - 03.03.2013, 12:41
Re: Roleplay Name Checker [Advanced] - by Yves - 05.03.2013, 06:23
Re: Roleplay Name Checker [Advanced] - by ExpertSahil - 05.03.2013, 08:10
Re: Roleplay Name Checker [Advanced] - by iFear - 05.03.2013, 08:15
Re: Roleplay Name Checker [Advanced] - by Kontrol - 05.03.2013, 10:23
Re: Roleplay Name Checker [Advanced] - by Vince - 05.03.2013, 11:55
Re: Roleplay Name Checker [Advanced] - by Luis- - 05.03.2013, 15:14
Respuesta: Roleplay Name Checker [Advanced] - by Dreyfuz - 05.03.2013, 18:55
Re: Roleplay Name Checker [Advanced] - by Zeus666 - 03.07.2016, 20:02
Re: Roleplay Name Checker [Advanced] - by Gammix - 03.07.2016, 20:17
Re: Roleplay Name Checker [Advanced] - by SickAttack - 04.07.2016, 03:31

Forum Jump:


Users browsing this thread: 2 Guest(s)