IsPlayerName ???
#1

Hello everyone !

I wonder if there is any function like "IsPlayerName" because I'm
working on "OnRconLoginAttemp" and I want to check that if the
name of the player is "insert name here" to don't kick him, just to say
"insert text here" , and if player name isnt "insert name here" just kick
him. So how can I do this ?

Thank you very much.

-jNkk
Reply
#2

yeap...

pawn Код:
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));

if(strcmp(pName, "name", true) == 0)//If Name = name
{

}
else if(strcmp(pName, "name", true) != 0)//If Isn't name
{

}
Mult Noroc
Reply
#3

pawn Код:
new Name[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, Name, MAX_PLAYER_NAME );

if( !strcmp( Name,"Raimis_R", true ) == 0 )
{
    // Logged
}
else
{
    //Kick Ban Etc.
}
Edit: I'm slow.
Reply
#4

Quote:
Originally Posted by Raimis_R
Посмотреть сообщение
pawn Код:
new Name[ MAX_PLAYER_NAME ];
GetPlayerName( playerid, Name, MAX_PLAYER_NAME );

if( !strcmp( Name,"Raimis_R", true ) == 0 )
{
    // Logged
}
else
{
    //Kick Ban Etc.
}
Edit: I'm slow.
Your code would not work. remove either the ==0 at the end or the ! at the start
Reply
#5

Just made this real fast;

pawn Код:
stock IsPlayerName(playerid,playername[])
{
    new pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
    if(!strcmp(pname,playername)) return 1;
    else return 0;
}
USAGE:
pawn Код:
if(IsPlayerName(playerid,"INSERTNAME"))
{

}
Reply
#6

So , this is my script, and I get these errors :

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));//105
    if(strcmp(pName, "jNkk1e", true) == 0)
    {
        SendClientMessage(playerid,0xFF0080FF,"{FFFF00FF}[SERVER]{FF0080FF}Tu esti creatorul serverului, deci deja Admin.");//108
        SendClientMessage(playerid,0xFF0080FF,"{FFFF00FF}[SERVER]{FF0080FF}Prin urmare, nu mai ai nevoie de Admin RCON :D");//109
    }
    else if(strcmp(pName, "jNkk1e", true) != 0)
    {
        SendClientMessage(playerid,0xFF0080FF,"{FFFF00FF}[SERVER]{FF0080FF}Ce faci aici? Chiar vrei sa te loghezi la RCON?");//113
        SendClientMessage(playerid,0xFF0080FF,"{FFFF00FF}[SERVER]{FF0080FF}Nu conteaza ca te-ai logat corect, ai primit Kick!");//114
        Kick(playerid);//115
    }
    return 1;
}
pawn Код:
C:\Documents and Settings\alin\Desktop\SimonSpune Romвnia\gamemodes\simsp.pwn(105) : error 017: undefined symbol "playerid"
C:\Documents and Settings\alin\Desktop\SimonSpune Romвnia\gamemodes\simsp.pwn(108) : error 017: undefined symbol "playerid"
C:\Documents and Settings\alin\Desktop\SimonSpune Romвnia\gamemodes\simsp.pwn(109) : error 017: undefined symbol "playerid"
C:\Documents and Settings\alin\Desktop\SimonSpune Romвnia\gamemodes\simsp.pwn(113) : error 017: undefined symbol "playerid"
C:\Documents and Settings\alin\Desktop\SimonSpune Romвnia\gamemodes\simsp.pwn(114) : error 017: undefined symbol "playerid"
C:\Documents and Settings\alin\Desktop\SimonSpune Romвnia\gamemodes\simsp.pwn(115) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.
What's wrong?

-jNkk
Reply
#7

playerid is not implemnented my mistake... you will need other .. way to check the name sry
Reply
#8

You need a for loop.
Reply
#9

Please write the code here I really don't understand because I'm
a begginer scripter and I suck at scripting

-jNkk
Reply
#10

pawn Код:
public OnRconLoginAttempt(ip[], password[], success);
{
    new pName[MAX_PLAYER_NAME];
   
    for (new i = GetMaxPlayers(), j; j < i; i++)
    {
        GetPlayerName(i, pName, sizeof (pName));

        if (!strcmp(pName, "name", true) && success)
        {
            // success
        }
        else
        {
            // got the password right, but he's not using the right name
        }
    }

    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)