How to Disable RP Nick Checker for Admins?
#1

Hello everybody. I have a tiny script for rp server. Its checks nicknames for _ character. If you login with Mark_Antony (Example) you can play, if you login without _ character you will be kicked. But I want to when I login with "Admin" name without _ character, i wont get kick.

This code not working. How can fix that ?

pawn Код:
public OnPlayerConnect(playerid)
{
    new adname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, adname, sizeof(adname));
        new adnamestring = strfind(adname, "Admin", true);
    if(adnamestring == -1)
    {
    SendClientMessage(playerid, COLOR_BM, ">> OK you are an admin, wait for login..");
    return 1;
    }
   
   
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new namestring = strfind(plname, "_", true);
    if(namestring == -1)
    {
        SendClientMessage(playerid, COLOR_BM, ">> Bad nickname.");
        SendClientMessage(playerid, COLOR_BM, ">> Name type: Firstname_Lastname.");
        Kick(playerid);
        return 1;
        }
    return 1;
    }
Reply
#2

pawn Код:
public OnPlayerConnect(playerid)
{
    new adname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, adname, sizeof(adname));
        new adnamestring = strfind(adname, "Admin", true);
    if(adnamestring == -1)
    {
        ShowPlayerNameTagForPlayer(playerid, i, false);
    SendClientMessage(playerid, COLOR_BM, ">> OK you are an admin, wait for login..");
    return 1;
    }
   
   
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new namestring = strfind(plname, "_", true);
    if(namestring == -1)
    {
        SendClientMessage(playerid, COLOR_BM, ">> Bad nickname.");
        SendClientMessage(playerid, COLOR_BM, ">> Name type: Firstname_Lastname.");
        Kick(playerid);
        return 1;
        }
    return 1;
    }
I'M Add ShowPlayerNameTagForPlayer(playerid, i, false);
Good LUCK
Reply
#3

You can check this at OnPlayerLogin or OnPlayerRegister, because I think the administrator level on your server is only loaded there.
Reply
#4

Quote:
Originally Posted by SmileyForCheat
Посмотреть сообщение
pawn Код:
public OnPlayerConnect(playerid)
{
    new adname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, adname, sizeof(adname));
        new adnamestring = strfind(adname, "Admin", true);
    if(adnamestring == -1)
    {
        ShowPlayerNameTagForPlayer(playerid, i, false);
    SendClientMessage(playerid, COLOR_BM, ">> OK you are an admin, wait for login..");
    return 1;
    }
   
   
    new plname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, plname, sizeof(plname));
    new namestring = strfind(plname, "_", true);
    if(namestring == -1)
    {
        SendClientMessage(playerid, COLOR_BM, ">> Bad nickname.");
        SendClientMessage(playerid, COLOR_BM, ">> Name type: Firstname_Lastname.");
        Kick(playerid);
        return 1;
        }
    return 1;
    }
I'M Add ShowPlayerNameTagForPlayer(playerid, i, false);
Good LUCK
Wtf? That will not work....

pawn Код:
public OnPlayerConnect( playerid )
{
    new
        useUnderscore[ MAX_PLAYERS ] = { 1, ... }
    ;

    new
        pName[ 24 ]
    ;

    GetPlayerName( playerid, pName, sizeof ( pName ) );

    if ( strfind( pName, "Admin", true ) != -1 ) {
        SendClientMessage(playerid, COLOR_BM, ">> OK you are an admin, wait for login..");
        useUnderscore[ playerid ] = 0;
    }

    useUnderscore[ playerid ] = 1;

    if ( useUnderscore[ playerid ] ) {
        if ( strfind( pName, "_", true ) == -1 ) {
            SendClientMessage(playerid, COLOR_BM, ">> Bad nickname.");
            SendClientMessage(playerid, COLOR_BM, ">> Name type: Firstname_Lastname.");
            Kick(playerid);
        }
    }

    return 1;
}
I think it will work like that...
Reply
#5

You need to load their admin level, before running the check to see if the name they connected with is "role play." Checking it under "OnPlayerConnect()" is not going to work unless you loaded their admin level before hand.
Reply
#6

Quote:
Originally Posted by Basicz
Посмотреть сообщение
Wtf? That will not work....

pawn Код:
public OnPlayerConnect( playerid )
{
    new
        useUnderscore[ MAX_PLAYERS ] = { 1, ... }
    ;

    new
        pName[ 24 ]
    ;

    GetPlayerName( playerid, pName, sizeof ( pName ) );

    if ( strfind( pName, "Admin", true ) != -1 ) {
        SendClientMessage(playerid, COLOR_BM, ">> OK you are an admin, wait for login..");
        useUnderscore[ playerid ] = 0;
    }

    useUnderscore[ playerid ] = 1;

    if ( useUnderscore[ playerid ] ) {
        if ( strfind( pName, "_", true ) == -1 ) {
            SendClientMessage(playerid, COLOR_BM, ">> Bad nickname.");
            SendClientMessage(playerid, COLOR_BM, ">> Name type: Firstname_Lastname.");
            Kick(playerid);
        }
    }

    return 1;
}

I think it will work like that...
These not working;



I give up make it like FS. I will use it on gamemode OnPlayerLogin with pAdmin (LARP GM) As Shadoww5 and RealCop228 said. But still dont know how to do it.
Reply
#7

pawn Код:
public OnPlayerConnect( playerid )
{
    new
        useUnderscore[ MAX_PLAYERS ] = { 1, ... }
    ;

    new
        pName[ 24 ]
    ;

    GetPlayerName( playerid, pName, sizeof ( pName ) );

    if ( strfind( pName, "Admin", true ) != -1 ) {
        SendClientMessage(playerid, COLOR_BM, ">> OK you are an admin, wait for login..");
        useUnderscore[ playerid ] = 0;
        return 1;
    }

    useUnderscore[ playerid ] = 1;

    if ( useUnderscore[ playerid ] ) {
        if ( strfind( pName, "_", true ) == -1 ) {
            SendClientMessage(playerid, COLOR_BM, ">> Bad nickname.");
            SendClientMessage(playerid, COLOR_BM, ">> Name type: Firstname_Lastname.");
            Kick(playerid);
        }
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)