find player by name? +rep!
#2

Using for

pawn Код:
stock FindPlayerByName(name[])
{
    new Pname[24];
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        GetPlayerName(i, Pname, 24);  
        if(!strcmp(Pname, name, true)) return i;
    }
    return -1;
}
Foreach is similar, just replace the for loop.
Reply


Messages In This Thread
find player by name? +rep! - by PawnoQ - 29.01.2012, 02:31
Re: find player by name? +rep! - by [HiC]TheKiller - 29.01.2012, 02:49
Respuesta: find player by name? +rep! - by admantis - 29.01.2012, 02:51
Re: find player by name? +rep! - by PawnoQ - 29.01.2012, 02:51
Re: find player by name? +rep! - by jamesbond007 - 29.01.2012, 02:54
Re: find player by name? +rep! - by [HiC]TheKiller - 29.01.2012, 02:56
Re: find player by name? +rep! - by PawnoQ - 29.01.2012, 02:58
Re: find player by name? +rep! - by PawnoQ - 29.01.2012, 03:31
Re: find player by name? +rep! - by Babul - 29.01.2012, 04:08
Re: find player by name? +rep! - by PawnoQ - 30.01.2012, 14:12

Forum Jump:


Users browsing this thread: 3 Guest(s)