Question sscanf "u"
#3

add this somewhere in ur script
pawn Код:
SSCANF:player_name(string[]) {
    new foundplayer = INVALID_PLAYER_ID, name[MAX_PLAYER_NAME];
    new bool:numeric = true;

    for (new i = 0, c; (c = string[i]); i++) {
        if (c < '0' || c > '9') {
            numeric = false;

            break;
        }
    }

    if (numeric) {
        foundplayer = strval(string);

        if (IsPlayerConnected(foundplayer))
            return foundplayer;
        else
            foundplayer = INVALID_PLAYER_ID;
    }

    foreach(new playerid : Player) {
        GetPlayerName(playerid, name, sizeof(name));

        if (strfind(name, string, true) != -1) {
            if (foundplayer != INVALID_PLAYER_ID)
                return INVALID_PLAYER_ID; // Multiple matches
            else
                foundplayer = playerid;
        }
    }

    return foundplayer;
}
Credits Come Back To Slice
And Replace The
Код:
 "u"
With
Код:
"k<player_name>"
Reply


Messages In This Thread
Question sscanf "u" - by andrew2695 - 08.09.2012, 18:51
Re: Question sscanf "u" - by SuperViper - 08.09.2012, 19:59
Re: Question sscanf "u" - by Opah - 08.09.2012, 21:35
Re: Question sscanf "u" - by Babul - 08.09.2012, 22:47

Forum Jump:


Users browsing this thread: 1 Guest(s)