Hey, so I've a mysql /rank with Trie, but now I would like to create a /top also, so I need first ... fifth player Name and Skill from mysql table's, the Name is in X table, Skill is in Y table, but both tables has same player IP's. How could I select them ? Here is my code:
Code:
new Entries;
new Trie:Positions;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
Positions = TrieCreate();
register_clcmd("say /rank", "CmdRank")
}
public CmdRank(id)
{
new szSteam[33];
get_user_authid(id, szSteam, 32)
client_print(id, print_chat, "you are %d of %d", GetPosition(szSteam), Entries)
}
public UpdateRank()
{
SQL_ThreadQuery(g_SqlTuple, "OnUpdateRank", "SELECT pSteam FROM pStats ORDER BY pSkill DESC");
}
public OnUpdateRank(failState, Handle:query, error[], errorCode)
{
if (errorCode)
set_fail_state(error);
Entries = 0;
new szSteam[33];
while (SQL_MoreResults(query))
{
SQL_ReadResult(query, 0, szSteam, charsmax(szSteam));
TrieSetCell(Positions, szSteam, Entries++);
SQL_NextRow(query);
}
}
GetPosition(const szSteam[])
{
new pos;
TrieGetCell(Positions, szSteam, pos);
return pos + 1;
}