SA-MP Forums Archive
[HELP] Name_Lastname - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Name_Lastname (/showthread.php?tid=85375)



[HELP] Name_Lastname - baxi - 07.07.2009

Hi

I want wo have that people need register with Name_Lastname
I use it for penls , can someone help me wht i need to do for it?


Re: [HELP] Name_Lastname - refshal - 07.07.2009

Ask in the PenLS thread.


Re: [HELP] Name_Lastname - baxi - 07.07.2009

i ddint get answer there can you not help me in this topic please?


Re: [HELP] Name_Lastname - MenaceX^ - 07.07.2009

Use strfind.


Re: [HELP] Name_Lastname - *ToM* - 07.07.2009

pawn Код:
public OnPlayerConnect(playerid)
{
    new tttstring[256];
    new playername[MAX_PLAYER_NAME],f;
    GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
    if(strfind(playername,"_",true,1)!=-1)
      f=1;
    if(playername[strlen(playername)-1]=='_')
      f=0;
    for(new i=0;i<strlen(playername);i++)
        if((playername[i]<='9')&&(playername[i]>='0'))
        f=0;
    if(!f)
    {
      format(tttstring, sizeof(tttstring), "AUTO-KICK: %s was kicked from the server, Reason: Invalid Name (Firstname_Lastname).",playername);
      SendClientMessage(playerid,0xF6EC00AA,"Invalid Name: Use this format: Firstname_Lastname.");
      SendClientMessageToAll(0xF64F00AA, tttstring);
      Kick(playerid);
    }
    return 1;
    }
}
untested


Re: [HELP] Name_Lastname - MenaceX^ - 07.07.2009

simply.
pawn Код:
new n[MAX_PLAYER_NAME];
GetPlayerName(playerid,n,sizeof(n));
if(strfind(n,"_",true)==-1)
{
  // other stuff
}
But my code doesn't check numbers, you IsNumeric.


Re: [HELP] Name_Lastname - baxi - 07.07.2009

Quote:
Originally Posted by Toniu_
pawn Код:
public OnPlayerConnect(playerid)
{
    new tttstring[256];
    new playername[MAX_PLAYER_NAME],f;
    GetPlayerName(playerid,playername,MAX_PLAYER_NAME);
    if(strfind(playername,"_",true,1)!=-1)
      f=1;
    if(playername[strlen(playername)-1]=='_')
      f=0;
    for(new i=0;i<strlen(playername);i++)
        if((playername[i]<='9')&&(playername[i]>='0'))
        f=0;
    if(!f)
    {
      format(tttstring, sizeof(tttstring), "AUTO-KICK: %s was kicked from the server, Reason: Invalid Name (Firstname_Lastname).",playername);
      SendClientMessage(playerid,0xF6EC00AA,"Invalid Name: Use this format: Firstname_Lastname.");
      SendClientMessageToAll(0xF64F00AA, tttstring);
      Kick(playerid);
    }
    return 1;
    }
}
untested
Thanks it works good