graczu
08-24-2007, 19:47
Hi i got this code in my plugin to get rank:
if somone say /rank starting this:
public GetMyRank(client){
if(userInit[client] == 1){
new String:steamId[64];
GetClientAuthString(client, steamId, sizeof(steamId));
decl String:buffer[512];
Format(buffer, sizeof(buffer), "SELECT * FROM css_rank WHERE steamId = '%s'", steamIdSave[client]);
if(DEBUG == 1){
PrintToServer("DEBUG: GetMyRank (%s)", buffer);
}
SQL_TQuery(db, SQLGetMyRank, buffer, client);
} else {
PrintToChat(client,"[RANK] Poczekaj na zaladowanie danych z Bazy");
}
}
This SQL_TQuery to SQLGetMyRank:
public SQLGetMyRank(Handle:owner, Handle:hndl, const String:error[], any:client){
decl RAkills;
decl RAdeaths;
decl RAheadshots;
decl RAsucsides;
if(SQL_FetchRow(hndl))
{
RAkills=SQL_FetchInt(hndl,0);
RAdeaths=SQL_FetchInt(hndl,1);
RAheadshots=SQL_FetchInt(hndl,2);
RAsucsides=SQL_FetchInt(hndl,3);
}
decl String:buffer[512];
Format(buffer, sizeof(buffer), "SELECT rank_id FROM css_rank WHERE kills >= '%i' AND deaths <= '%i'", RAkills, RAdeaths);
if(DEBUG == 1){
PrintToServer("DEBUG: SQLGetMyRank (%s)", buffer);
}
SQL_TQuery(db, SQLShowRank, buffer, client);
PrintToChat(client,"[STATS] Fragow: %i | Smierci: %i | Trafien w Glowe: %i | Samobojstw: %i", RAkills, RAdeaths, RAheadshots, RAsucsides);
}
and fin shows the rank:
public SQLShowRank(Handle:owner, Handle:hndl, const String:error[], any:client){
if (SQL_HasResultSet(hndl))
{
printRank(hndl, client)
} else {
PrintToChat(client,"[RANK] H@H@ nie ma cie w ranku n00b13.");
}
}
and problem is with that, when client say /rank
he gets some strange numbers in kills,deaths (34346346346, -234535),.... and strange rank like 3453464567457457 or -43534643576
what is wrong in here?
i attach whole plugin
if somone say /rank starting this:
public GetMyRank(client){
if(userInit[client] == 1){
new String:steamId[64];
GetClientAuthString(client, steamId, sizeof(steamId));
decl String:buffer[512];
Format(buffer, sizeof(buffer), "SELECT * FROM css_rank WHERE steamId = '%s'", steamIdSave[client]);
if(DEBUG == 1){
PrintToServer("DEBUG: GetMyRank (%s)", buffer);
}
SQL_TQuery(db, SQLGetMyRank, buffer, client);
} else {
PrintToChat(client,"[RANK] Poczekaj na zaladowanie danych z Bazy");
}
}
This SQL_TQuery to SQLGetMyRank:
public SQLGetMyRank(Handle:owner, Handle:hndl, const String:error[], any:client){
decl RAkills;
decl RAdeaths;
decl RAheadshots;
decl RAsucsides;
if(SQL_FetchRow(hndl))
{
RAkills=SQL_FetchInt(hndl,0);
RAdeaths=SQL_FetchInt(hndl,1);
RAheadshots=SQL_FetchInt(hndl,2);
RAsucsides=SQL_FetchInt(hndl,3);
}
decl String:buffer[512];
Format(buffer, sizeof(buffer), "SELECT rank_id FROM css_rank WHERE kills >= '%i' AND deaths <= '%i'", RAkills, RAdeaths);
if(DEBUG == 1){
PrintToServer("DEBUG: SQLGetMyRank (%s)", buffer);
}
SQL_TQuery(db, SQLShowRank, buffer, client);
PrintToChat(client,"[STATS] Fragow: %i | Smierci: %i | Trafien w Glowe: %i | Samobojstw: %i", RAkills, RAdeaths, RAheadshots, RAsucsides);
}
and fin shows the rank:
public SQLShowRank(Handle:owner, Handle:hndl, const String:error[], any:client){
if (SQL_HasResultSet(hndl))
{
printRank(hndl, client)
} else {
PrintToChat(client,"[RANK] H@H@ nie ma cie w ranku n00b13.");
}
}
and problem is with that, when client say /rank
he gets some strange numbers in kills,deaths (34346346346, -234535),.... and strange rank like 3453464567457457 or -43534643576
what is wrong in here?
i attach whole plugin