I have a database which is called player_player. In that database i have following.
Username | Steam id | Kills | Deaths | Headshots | Points
I have a plugin which prints out my points like this:
[SERVERNAME] Your points 1000
I would like it to print out more stuff like kills & deaths but dont have a clue how to.
PHP Code:
public showPlayerRank(id)
{
static query[512];
formatex(query, charsmax(query), "SELECT COUNT(*) FROM player_player WHERE points > '%d'", pPoints[id]);
log_amx(query)
static data[2];
data[0] = id;
SQL_ThreadQuery(g_hTuple, "QueryLoadRank", query, data, sizeof(data));
return PLUGIN_HANDLED;
}
public QueryLoadRank(failstate, Handle:hQuery, error[], errnum, data[], size, Float:queuetime)
{
if( failstate == TQUERY_CONNECT_FAILED
|| failstate == TQUERY_QUERY_FAILED )
{
set_fail_state(error);
}
else
{
new id = data[ 0 ];
if(SQL_NumResults(hQuery))
{
new colRank = SQL_ReadResult(hQuery, 0) + 1;
client_printcolor(id, "/y[/ctr%s/y] Your points /ctr%d", PREFIX, colRank);
}
}
}
Extra stuff in the script.
PHP Code:
pKills[id] = 0;
pDeaths[id] = 0;
pHeadshots[id] = 0;
pPoints[id] = 0;
////////////////////////////////////////////////////////////////////////////////////////////////////////
I have tryed following. But it prints out wrong number, that numbers doesnt exist in database so what am i doing wrong and how to fix it?
PHP Code:
formatex(query, charsmax(query), "SELECT COUNT(*) FROM player_player WHERE points > '%d'", pKills[id]);