2021-04-18, 09:24 PM
So I am trying to show offline stats of a player and?I am fetching the results from the database to show in game but one of the columns do not show in there. But if i print the string, it shows the result there. Basically i fetch a few columns and format them into a string to show in a textdraw. As you can see here,?
It shows everything but not the Last Seen which is also fetched from database. On printing the string, this is the result:
In the code above, you can clearly see its printing "Last Seen On:" thing but it wont show it in game. Here is the code:
Any idea what could be wrong here? Also, increasing the string size wouldn't help either.
It shows everything but not the Last Seen which is also fetched from database. On printing the string, this is the result:
Code:
~p~Username: ~w~localhost~n~~p~Score: ~w~10~n~~p~Kills:~w~ 0~n~~p~Deaths:~w~ 0~n~~p~Money:~w~ $50,000~n~~p~Last On:~w~ 04-05-2021
In the code above, you can clearly see its printing "Last Seen On:" thing but it wont show it in game. Here is the code:
Code:
CMD:osts(playerid, params[])
{
? ? new query[128], string2[128], accountname[24], ohours, omins, oscore, obal, okills, odeaths, ologged[128];
? ? if(sscanf(params, "s[24]", accountname))
? ? ? ? return SendClientMessage(playerid, COLOR_RED, "USAGE: /osts [account name]");
? ? mysql_format(g_SQL, query, sizeof(query), "SELECT score,hours,minutes,money,kills,deaths, laston FROM `players` WHERE `username` = '%e'",accountname);
? ? new Cache:result;
? ? result = mysql_query(g_SQL, query, true);
? ? new rows = cache_num_rows();
? ? if(rows)
? ? {? ? ?
? ? ? ? new string[1024];
? ? ? ? PlayerTextDrawShow(playerid, OStatsTD[playerid][0]);
? ? ? ? PlayerTextDrawShow(playerid, OStatsTD[playerid][1]);
? ? ? ? PlayerTextDrawShow(playerid, OStatsTD[playerid][3]);
? ? ? ? for (new i = 0; i < rows; i )
? ? ? ? {
? ? ? ? ? ? cache_get_value_name(i, "laston", ologged);
? ? ? ? ? ? cache_get_value_name_int(i, "kills", okills);
? ? ? ? ? ? cache_get_value_name_int(i, "deaths", odeaths);
? ? ? ? ? ? cache_get_value_name_int(i, "score", oscore);
? ? ? ? ? ? cache_get_value_name_int(i, "hours", ohours);
? ? ? ? ? ? cache_get_value_name_int(i, "minutes", omins);
? ? ? ? ? ? cache_get_value_name_int(i, "money", obal);
? ? ? ? ? ?
? ? ? ? ? ? format(string, sizeof(string), "~p~Username: ~w~%s~n~~p~Score: ~w~%d~n~~p~Kills:~w~ %d~n~~p~Deaths:~w~ %d~n~~p~Money:~w~ %s~n~~p~Last On:~w~ %s", accountname,oscore,okills,odeaths,formatInt(obal), ologged);
? ? ? ? }
? ? ? ? PlayerTextDrawSetString(playerid, OStatsTD[playerid][2], string);
? ? ? ? PlayerTextDrawShow(playerid, OStatsTD[playerid][2]);?
? ? ? ? SetTimerEx("tdhide", 10000, false, "i", playerid);?
? ? ? ?
? ? ? ? cache_delete(result);
? ? }
? ? else
? ? format(string2, sizeof(string2), "ERROR: %s isn't found in the database." ,accountname);
? ? SendClientMessage(playerid, COLOR_RED, string2);
? ? return 1;
}
Any idea what could be wrong here? Also, increasing the string size wouldn't help either.