Anti-Name Issue!
#1

i have an anti-name but it doesent work it workes for everybody its supposed to work only the guys that dont have FirstName_LastName!and the server restarts at onplayerconnect please help!

PHP код:
                new pname[MAX_PLAYER_NAME];
                      new 
namestr strfind(pname"_"true);
                    if(
namestr == -1)
                    {
                    
GetPlayerName(playeridpnamesizeof(pname));
                    
SendClientMessage(playeridCOLOR_RED"Your name must be like this Firstname_Lastname");
                    
Kick(playerid);
                    return 
1;
                    } 
Reply
#2

pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
new namestr = strfind(pname, "_", true);
if(namestr == -1)
{
    SendClientMessage(playerid, COLOR_RED, "Your name must be like this Firstname_Lastname");
    Kick(playerid);
    return 1;
}
Reply
#3

pawn Код:
if(PlayerInfo[playerid][pAdmin] == 0)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        if(strfind(pName, "_", true) == -1)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "You must have a name following the Firstname_Lastname format. You got kicked as a result!");
            Kick(playerid);
        }
    }
Change "pAdmin" into your admin variable.
Reply
#4

Quote:
Originally Posted by Sandiel
Посмотреть сообщение
pawn Код:
if(PlayerInfo[playerid][pAdmin] == 0)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        if(strfind(pName, "_", true) == -1)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "You must have a name following the Firstname_Lastname format. You got kicked as a result!");
            Kick(playerid);
        }
    }
Change "pAdmin" into your admin variable.
it works but i dont get a kick and a Message..that its my name..
Reply
#5

Quote:
Originally Posted by Akcent_Voltaj
Посмотреть сообщение
it works but i dont get a kick and a Message..that its my name..
You mean you don't get kicked? put it under OnPlayerConnect...
Also, it works for non-admins only.
Reply
#6

i took out the admins part..i dont get kicked and messaje doesent appear i just get restart serving..
Reply
#7

Are you sure you placed it under OnPlayerConnect?
pawn Код:
public OnPlayerConnect(playerid)
{
    // Roleplay name checker, for non-admins.
    if(PlayerInfo[playerid][pAdmin] == 0)
    {
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pName, sizeof(pName));
        if(strfind(pName, "_", true) == -1)
        {
            SendClientMessage(playerid, COLOR_YELLOW, "You must have a name following the Firstname_Lastname format. You got kicked as a result!");
            Kick(playerid);
        }
    }
    return 1;
}
Код:
This forum requires that you wait 120 seconds between posts. Please try again in 17 seconds.
Reply
#8

Use this one: http://pastebin.com/kxvK8vGq
Example:
pawn Код:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME];
    GetPlayerName(playerid,name,MAX_PLAYER_NAME);
    if(!IsARolePlayName(name)) {
        //Kick him here.
    } else {
        //Your code if it's a good name. :)
    }
    return 1;
}
PD: I don't know who scripted it, not mine.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)