I've done some research and ended up with this query.
SET @row_num = 0;
SELECT
@row_num := @row_num + 1 as row_number
,id
,maxPoints
FROM users
ORDER BY maxPoints
...that gives me indexes of table ordered by maxPoints. And now comes the query for smarter people...
How do I get the row_number WHERE id = $i AND ... (other parameters) from this result.
Is it possible to do it by one composed query or do I need to split those queries on php side? I'm not able to put it up syntactically.