I just tested this with a local SQLite database, and it seems that AMXX has such an old version of SQLite that it doesn't support CTE's (common table expressions), or window functions like RANK(). I did some research and these features were introduced in SQLite after 2013, so that's probably why you're seeing the syntax error.
I checked the SQLite version of AMXX 1.9.0:
Code:
format( sQuery, charsmax(sQuery), "SELECT sqlite_version();");
->
L 05/04/2024 - 17:59:07: [zm_rank.amxx] Current version of SQLite: 3.24.0
CTEs were indroduced from version 3.8.3, and window functions were introduced in 3.25.0.
I've simplified the query, I replaced all the newer functions with subqueries that should be compatible with almost any version of SQLite, so try this:
Spoiler
PHP Code:
format( sQuery, charsmax(sQuery),
"\
SELECT \
`steamid`, \
`name`, \
`score`, \
(SELECT COUNT(*) FROM `%s` WHERE `score` > p.`score`) + 1 AS `rank`, \
(SELECT COUNT(*) FROM `%s`) AS `total_players`, \
`points`, \
`infections`, \
`kills`, \
`deaths` \
FROM \
`%s` p \
WHERE \
`steamid` = '%s';",
TABLE, TABLE, TABLE, sAuth
);