how to use this(GetPlayerId) Help!
#7

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Sorry but I think the GetPlayerID could be done better. (whoever made that function)
Now it makes a new 'pName' 500 times etc. I would prefer this one:

pawn Код:
stock GetPlayerID(const name[])
{
    new pName[MAX_PLAYER_NAME];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        GetPlayerName(i, pName, MAX_PLAYER_NAME);
        if(!strcmp(pName, name))
            return i;
    }
    return INVALID_PLAYER_ID;
}
You are right, thank you. The function wasn't written by me, I ripped it off from a thread nearby.
Reply


Messages In This Thread
how to use this(GetPlayerId) Help! - by eixas1000 - 16.04.2011, 16:44
Re: how to use this(GetPlayerId) Help! - by admantis - 16.04.2011, 16:48
Re: how to use this(GetPlayerId) Help! - by eixas1000 - 16.04.2011, 17:03
Re: how to use this(GetPlayerId) Help! - by admantis - 16.04.2011, 17:04
Re: how to use this(GetPlayerId) Help! - by eixas1000 - 16.04.2011, 17:10
Re: how to use this(GetPlayerId) Help! - by Kwarde - 16.04.2011, 17:27
Re: how to use this(GetPlayerId) Help! - by admantis - 16.04.2011, 17:28

Forum Jump:


Users browsing this thread: 4 Guest(s)