FirstName_Lastname..problem
#1

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

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;
}
Reply
#3

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..
Reply
#4

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;
}
Reply
#5

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..
Reply
#6

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);
Reply
#7

****** "SA:MP Roleplay Name Checker" Simple
Reply
#8

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

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
Reply
#10

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;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)