SSCANF
#3

I didn't test it out, but it should work:
Код:
SSCANF:playername(string[])
{
    if (isnull(string))
        return INVALID_PLAYER_ID;

    new tmp;
    if (!sscanf(params, "i", tmp))
    {
        if (!IsPlayerConnected(tmp))
            return INVALID_PLAYER_ID;
        return tmp;
    }

    new player_name[25];
    for (new i, j = GetPlayerPoolSize(); i <= j; i++)
    {
        if (IsPlayerConnected(i))
            continue;
        GetPlayerName(i, player_name, 25);
        if (player_name[0] == '[' && (tmp = strfind(player_name, "]", false)) != -1)
        {
            if (!strcmp(player_name[tmp+1], string, true, strlen(string))
            {
                return i;
            }
        }
    }
    return INVALID_PLAYER_ID;
}
But it will bug if there is another ']' inside of the clan tag.
You could improve it if you want.

Use "k<playername>" instead of "u".
Reply


Messages In This Thread
SSCANF - by Spenker - 04.08.2016, 17:22
Re: SSCANF - by diego200052 - 04.08.2016, 17:44
Re: SSCANF - by Stinged - 04.08.2016, 17:54
Re: SSCANF - by Konstantinos - 04.08.2016, 18:08

Forum Jump:


Users browsing this thread: 1 Guest(s)