View Full Version : /stats

05/05/2016, 05:11 PM
CMD:stats(playerid, params[])
new string1[256], string2[256];
format(string1, sizeof(string1), ""COL_WHITE"Name: %s (%d) | $%d | Score: %d\n", GetName(playerid), playerid, GetPlayerMoney(playerid), GetPlayerScore(playerid));
format(string2, sizeof(string2), "Kills: %d | Deaths: %d | K/D Ratio: %.1f\n", pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][Kills] / pInfo[playerid][Deaths]);
strcat(string1, string2);
format(string2, sizeof(string2), "Admin Level: %d | VIP Level: %d | Hours Played: %.2f", pInfo[playerid][AdminLevel], pInfo[playerid][VIPLevel], pInfo[playerid][HoursPlayed]);
strcat(string1, string2);
ShowPlayerDialog(playerid, d_stats, DIALOG_STYLE_MSGBOX, "Statistics", string1, "OK", "");
return 1;
Returns 0 with me. d_stats is good.

05/05/2016, 05:30 PM
What is wrong here ?

05/05/2016, 05:31 PM
It returns 0 with me, which means "ERROR: command not found"

05/05/2016, 05:55 PM
That is probably a Runtime error 11: "Divide by zero" on pInfo[playerid][Kills] / pInfo[playerid][Deaths]

You can load crashdetect for more information about crashes and run time errors. If that is the cause of it, then change to:

floatdiv(pInfo[playerid][Kills], pInfo[playerid][Deaths])