SA-MP Forums Archive
FirstName_Lastname..problem - 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)
+--- Thread: FirstName_Lastname..problem (/showthread.php?tid=373236)



FirstName_Lastname..problem - Akcent_Voltaj - 29.08.2012

i cant find a filterscript that is firstname_lastname dont worry i looked on ****** and on samp.com and cant find please..suggest..


Re: FirstName_Lastname..problem - lamarr007 - 29.08.2012

You think
pawn Код:
public OnPlayerConnect(playerid)
{
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new namestring = strfind(plname, "_", true);
    if(namestring == -1)
    {
        SendClientMessage(playerid, 0xFF0000C8, "Your name isґnt a RP format.");
        Kick(playerid);
        return 1;
    }
    return 1;
}



Re: FirstName_Lastname..problem - Akcent_Voltaj - 29.08.2012

no work i enter game with XXX and it says connected then restarting no message appears and no kick..its under onplayerconect no errors..help please!

EDIT:i bet that if i put it at other gamemode it will work i dont understand why it wont work mine..


Re: FirstName_Lastname..problem - leonardo1434 - 29.08.2012

Try that, it check if the "_" exists and has letters around it. otherwise, he will be kicked.
pawn Код:
public OnPlayerConnect(playerid)
{
    static name[MAX_PLAYER_NAME],i = 0,u,bool:fail[MAX_PLAYERS];
    GetPlayerName(playerid, name, sizeof name);
    u = strlen(name);
    for(; i < u; ++i)
    {
       if(name[i] == '_')
       {
          i--;
          if('a' >= name[i] <= 'z' || 'A' >= name[i] <= 'Z')
          {
             i+= 2;
             if('a' >= name[i] <= 'z' || 'A' >= name[i] <= 'Z')
             {
                 fail[playerid] = false;
                 break;
             }
          }
       }
       fail[playerid] = true;
    }
    if(fail[playerid] == true)
    {
       SendClientMessage(playerid, 0xFF0000C8, "Your name isґnt a RP format.");
       Kick(playerid);
    }
    return 1;
}



Re: FirstName_Lastname..problem - Akcent_Voltaj - 29.08.2012

Quote:
Originally Posted by leonardo1434
Посмотреть сообщение
Try that, it check if the "_" exists and has letters around it. otherwise, he will be kicked.
pawn Код:
public OnPlayerConnect(playerid)
{
    static name[MAX_PLAYER_NAME],i = 0,u,bool:fail[MAX_PLAYERS];
    GetPlayerName(playerid, name, sizeof name);
    u = strlen(name);
    for(; i < u; ++i)
    {
       if(name[i] == '_')
       {
          i--;
          if('a' >= name[i] <= 'z' || 'A' >= name[i] <= 'Z')
          {
             i+= 2;
             if('a' >= name[i] <= 'z' || 'A' >= name[i] <= 'Z')
             {
                 fail[playerid] = false;
                 break;
             }
          }
       }
       fail[playerid] = true;
    }
    if(fail[playerid] == true)
    {
       SendClientMessage(playerid, 0xFF0000C8, "Your name isґnt a RP format.");
       Kick(playerid);
    }
    return 1;
}
same The server is restarting 1(x)
connected then same...nothing change from the first thing theres a thingy at gamemode..


Re: FirstName_Lastname..problem - Dubya - 29.08.2012

Yeah, it kicks you so fast, that you don't see it kick you. You could do this, instead of Kick(playerid), do:
pawn Код:
SetTimerEx("Kick", 3000, false, "i", playerid);



Re: FirstName_Lastname..problem - ZBits - 29.08.2012

****** "SA:MP Roleplay Name Checker" Simple


Re: FirstName_Lastname..problem - Akcent_Voltaj - 29.08.2012

but i dont get message... why should i put sendclient messaje COLOR_BLUE insted of COLOR_BLUE i should put -1?


Re: FirstName_Lastname..problem - Akcent_Voltaj - 30.08.2012

Quote:
Originally Posted by Dubya
Посмотреть сообщение
Yeah, it kicks you so fast, that you don't see it kick you. You could do this, instead of Kick(playerid), do:
pawn Код:
SetTimerEx("Kick", 3000, false, "i", playerid);
i dont get kicked but i get message


Re: FirstName_Lastname..problem - leonardo1434 - 30.08.2012

use this code... put there in the exactly way it is here.

most problem this code is not working well, cause you got a "return" before it, that's why i'm telling you to let this whole code alone on onplayerconnect.
pawn Код:
public OnPlayerConnect(playerid)
{
    static name[MAX_PLAYER_NAME],i = 0,u,bool:fail[MAX_PLAYERS];
    GetPlayerName(playerid, name, sizeof name);
    u = strlen(name);
    for(; i < u; ++i)
    {
       if(name[i] == '_')
       {
          i--;
          if('a' >= name[i] <= 'z' || 'A' >= name[i] <= 'Z')
          {
             i+= 2;
             if('a' >= name[i] <= 'z' || 'A' >= name[i] <= 'Z')
             {
                 fail[playerid] = false;
                 break;
             }
          }
       }
       fail[playerid] = true;
    }
    if(fail[playerid] == true)
    {
       SendClientMessage(playerid,-1, "Your name isґnt a RP format.");
       Kick(playerid);
    }
    return 1;
}