PHP Code:
public Action Event_PlayerConnect(Event event, const char[] name, bool dontBroadcast)
{
int Id = event.GetInt("userid");
int Client = GetClientOfUserId(Id);
if(Client != 0)
{
IntRank[Client] = 0;
IntHeadshots[Client] = 0;
IntKills[Client] = 0;
IntDeaths[Client] = 0;
int Steam = GetSteamAccountID(Client);
if(Steam != 0)
{
char Query[256];
FormatEx(Query, sizeof(Query), "SELECT count(*), s2.Total, s2.kills, s2.deaths, s2.hs FROM (SELECT steamid, name, sum(score) Total FROM rank_table GROUP BY steamid) s join (SELECT steamid, name, sum(score) Total, kills, deaths, hs FROM rank_table GROUP BY steamid) s2 ON s2.steamid = %d AND (s.Total > s2.Total OR s.Total = s2.Total AND s.name <= s2.name);", Steam);
DatabaseDB.Query(functionSQLRank, Query, Id, DBPrio_Normal);
}
}
}
public void functionSQLRank(Database db, DBResultSet rs, const char[] error, any data)
{
if(rs == null)
{
LogError("(functionSQLRank) %s", error);
}
else
{
int Client = GetClientOfUserId(data);
if(Client != 0)
{
if(rs.FetchRow())
{
IntRank[Client] = rs.FetchInt(0);
IntScore[Client] = rs.FetchInt(1);
int Kills = rs.FetchInt(2);
int Deaths = rs.FetchInt(3);
int Headshots = rs.FetchInt(4);
FloatKPD[Client] = GetKPD(Kills, Deaths);
IntPercent[Client] = GetHeadshotPercent(Headshots, Kills);
}
}
}
}
for steamid: 80995191
0 rank, 0 score etc
in my table 80995191 has 23 rank, 23 score etc.
in phpmyadmin the query works fine, but in sourcemod all entries are 0, why?