SA-MP Forums Archive
How to Disable RP Nick Checker for Admins? - 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: How to Disable RP Nick Checker for Admins? (/showthread.php?tid=267541)



How to Disable RP Nick Checker for Admins? - Matz - 08.07.2011

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



Re: How to Disable RP Nick Checker for Admins? - SmileyForCheat - 08.07.2011

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


Re: How to Disable RP Nick Checker for Admins? - Shadoww5 - 09.07.2011

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


Re: How to Disable RP Nick Checker for Admins? - Basicz - 09.07.2011

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...


Re: How to Disable RP Nick Checker for Admins? - Scenario - 09.07.2011

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.


Re: How to Disable RP Nick Checker for Admins? - Matz - 09.07.2011

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.


Re: How to Disable RP Nick Checker for Admins? - jameskmonger - 09.07.2011

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