08.11.2015, 22:47
MATCH_NAME_PARTIAL:
CELLMIN_ON_MATCHES:
pawn Код:
Currently sscanf will search for players by name, and will ALWAYS search for player whose name STARTS with the specified string. If you have, say "[CLAN]******" connected and someone types "******", sscanf will not find "[CLAN]******" because there name doesn't start with the specified name. This option, when set to 1, will search ANYWHERE in the player's name for the given string.
pawn Код:
Whatever the value of "MATCH_NAME_PARTIAL", the first found player will always be returned, so if you do a search for "_" on an RP server, you could get almost anyone. To detect this case, if more than one player will match the specified string then sscanf will return an ID of "cellmin" instead. This can be combined with "U" for a lot more power:
pawn Код:
sscanf(params, "?<CELLMIN_ON_MATCHES=1>U(-1)", id);
if (id == -1)
{
// No player was entered.
}
else if (id == cellmin)
{
// Multiple matches found
}
else if (id == INVALID_PLAYER_ID)
{
// Entered player is not connected.
}
else
{
// Found just one player.
}