How to make a anti-non-rp-name system help.
#5

First of all, using his example people can scam the system by just putting "name_". A better example would be checking if the surname has a greater length than 1 assuming they have an _.

pawn Код:
if(strfind(pName, "_", true) == -1)
{
     // code
}

else
{
     if(strlen(GetPlayerSurname(playerid) == 0)
     {
           SendClientMessage(playerid, -1, "Invalid last name.");
           Kick(playerid);
           return 0;
     }
}
Using a stock such as:
pawn Код:
stock GetPlayerSurname(playerid)
{
    new pName[24];
    GetPlayerName(playerid, pName, sizeof(pName));
    for(new i = 0; i < 24; i++)
    {
        if(pName[i] == '_')
        {
            strdel(pName, 0, i);
        }
    }
    return pName;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)