How to make RPG names Name_Surname
#1

Hi how to make players only allow to use Name_Surname... ?
Reply
#2

Seriously? I cant even fathom how many times this has been answered! Please use the search feature, there are tons of gamemodes that use it and tons of different versions in the useful function thread alone.
Reply
#3

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Seriously? I cant even fathom how many times this has been answered! Please use the search feature, there are tons of gamemodes that use it and tons of different versions in the useful function thread alone.
shut up
Reply
#4

Quote:
Originally Posted by Artie_Scorpion
Посмотреть сообщение
shut up
wow...
Reply
#5

Quote:
Originally Posted by [NOR]John
Посмотреть сообщение
wow...
you better too
Reply
#6

Quote:
Originally Posted by Artie_Scorpion
Посмотреть сообщение
you better too
and if i dont?
Reply
#7

Add this somewhere under OnPlayerConnect:
PHP код:
if(!IsRolePlayName(playerid))
{
    
SendClientMessage(playerid,0xFF0000FF"That's not RolePlay Name! Example: Firstname_Lastname");
    
Kick(playerid);

Add the bottom of your script:
PHP код:
stock IsRolePlayName(playeridbool:alphaonly true)
{
    new 
trpn[MAX_PLAYER_NAME];
    
    if(
GetPlayerName(playerid,trpn,sizeof(trpn)))
    {
        new 
strd strfind(trpn"_"false);
        if(
strfind(trpn,"_",false,strd+1) == -1)
        {
            if(
strd 0)
            {
                if(
trpn[strd-1] && trpn[strd+1])
                {
                    if(
alphaonly)
                    {
                        for(new 
0strlen(trpn); la++)
                        {
                            switch(
trpn[a])
                            {
                                case 
'0' .. '9': return 0;
                                case 
'a' .. 'z': continue;
                                case 
'A' .. 'Z': continue;
                                case 
'_': continue; // easier than specifying every invalid char
                                
default: return 0;
                            }
                        }
                    }
                    return 
1;
                }
            }
        }
    }
    return 
0;

Damn, Am i the only one who's actually helping around here?!
Reply
#8

Quote:
Originally Posted by Mrki_Drakula
Посмотреть сообщение
Add this somewhere under OnPlayerConnect:
PHP код:
if(!IsRolePlayName(playerid))
{
    
SendClientMessage(playerid,0xFF0000FF"That's not RolePlay Name! Example: Firstname_Lastname");
    
Kick(playerid);

Add the bottom of your script:
PHP код:
stock IsRolePlayName(playeridbool:alphaonly true)
{
    new 
trpn[MAX_PLAYER_NAME];
    
    if(
GetPlayerName(playerid,trpn,sizeof(trpn)))
    {
        new 
strd strfind(trpn"_"false);
        if(
strfind(trpn,"_",false,strd+1) == -1)
        {
            if(
strd 0)
            {
                if(
trpn[strd-1] && trpn[strd+1])
                {
                    if(
alphaonly)
                    {
                        for(new 
0strlen(trpn); la++)
                        {
                            switch(
trpn[a])
                            {
                                case 
'0' .. '9': return 0;
                                case 
'a' .. 'z': continue;
                                case 
'A' .. 'Z': continue;
                                case 
'_': continue; // easier than specifying every invalid char
                                
default: return 0;
                            }
                        }
                    }
                    return 
1;
                }
            }
        }
    }
    return 
0;

Damn, Am i the only one who's actually helping around here?!
You are my live saver.
Reply
#9

@Artie, Kyosaur was doing what anyother person would say, I would say it. You need to have a bit of Respect.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)