find player by name? +rep!
#10

would this code work to check if a player with a certain id and name is online?

pawn Код:
foreach(Player,i)
{
    if(FindPlayerByName(DOMPlayer)!= -1)//if player is online
    {
        new DOMname[24];
        GetPlayerName(i,DOMname,24);
        if(strfind(DOMname,"PawnoQ", true) == 0)//if player is the player with the right name
        {
            SetPlayerScore(i,GetPlayerScore(i)+20);//give only him score
        }
    }
    else
    {
        //if player is not online
    }
}



stock FindPlayerByName(name[])
{
    new Pname[24];
    foreach(Player,i)
    {
        GetPlayerName(i, Pname, 24);
        if(!strcmp(Pname, name, true)) return i;
    }
    return -1;
}
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)